Skip to content

Commit 8cb3e31

Browse files
committed
fix(test): resolve worker thread termination and import errors
Switches vitest to single-thread mode to prevent tinypool race conditions that caused intermittent worker thread termination errors. Also fixes @socketsecurity/lib imports to use /types subpath export instead of bare package import which lacks a main export.
1 parent e41779d commit 8cb3e31

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

.config/vitest.config.mts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ export default defineConfig({
6363
isolate: true,
6464
},
6565
threads: {
66-
// Use single thread for coverage to reduce memory, parallel otherwise.
67-
singleThread: isCoverageEnabled,
68-
maxThreads: isCoverageEnabled ? 1 : 16,
69-
minThreads: isCoverageEnabled ? 1 : 4,
66+
// Use single thread to prevent worker termination errors.
67+
// Multiple threads with isolate: false can cause race conditions in tinypool cleanup.
68+
singleThread: true,
69+
maxThreads: 1,
70+
minThreads: 1,
7071
// IMPORTANT: isolate: false for performance and test compatibility
7172
//
7273
// Tradeoff Analysis:
@@ -90,12 +91,6 @@ export default defineConfig({
9091
// Reduce timeouts for faster failures
9192
testTimeout: 10_000,
9293
hookTimeout: 10_000,
93-
// Speed optimizations
94-
// Note: cache is now configured via Vite's cacheDir
95-
sequence: {
96-
// Run tests concurrently within suites
97-
concurrent: true,
98-
},
9994
// Bail early on first failure in CI
10095
bail: process.env.CI ? 1 : 0,
10196
coverage: {

scripts/validate-no-link-deps.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env node
21
/**
32
* @fileoverview Validates that no package.json files contain link: dependencies.
43
* Link dependencies are prohibited - use workspace: or catalog: instead.

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ SOFTWARE.
4141

4242
/* c8 ignore start - Re-export only file, no logic to test */
4343

44-
export type { PURLString } from '@socketsecurity/lib'
44+
export type { PURLString } from '@socketsecurity/lib/types'
4545
// ============================================================================
4646
// Registry Integration
4747
// ============================================================================
4848
// Re-export PURL types from socket-registry for consistency
49-
export { PURL_Type } from '@socketsecurity/lib'
49+
export { PURL_Type } from '@socketsecurity/lib/types'
5050
// ============================================================================
5151
// TypeScript Type Definitions
5252
// ============================================================================

0 commit comments

Comments
 (0)