Skip to content

Commit 650715b

Browse files
committed
chore(test): wire vitest, fleet alignment + dep cleanup
Phase B (test wiring) + Phase D (light dep cleanup). Test: - Add test/smoke.test.mts placeholder (vitest exits 1 when no tests found and the fleet scripts/test.mts doesn't pass --passWithNoTests for all-mode runs). - Add vitest.config.mts at root re-exporting .config/vitest.config.mts. Fleet keeps configs in .config/ but vitest auto-discovers from cwd. - Migrate poolOptions.threads.* to top-level maxWorkers/minWorkers (vitest 4 deprecation). - Scope vitest discovery to repo's own test/ via dir + exclude .claude/** (skips hook node:test suites). Dep cleanup: - Drop @socketsecurity/config (unused). - Drop @types/micromatch (unused). - Switch @socketsecurity/lib + @types/node to catalog: references. Known dead code surfaced by tsgo noUnusedLocals (kept disabled pending focused removal pass): src/auth.ts(293), executable.ts(60), interpreter.ts(301), import-finder.ts(5), decorations.ts(30,31,300), parse-externals.ts(17,500), languages.ts(1), util.ts(136). Verified: check + test --all + build all green.
1 parent b41baec commit 650715b

5 files changed

Lines changed: 41 additions & 47 deletions

File tree

.config/vitest.config.mts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,26 @@ export default defineConfig({
1616
},
1717
globals: false,
1818
environment: 'node',
19+
// Disable workspace-project discovery — pnpm-workspace.yaml lists
20+
// .claude/hooks/* as workspace packages so they get treated as
21+
// their own vitest projects, but those tests use node:test and
22+
// are run by the hooks themselves, not by this repo's vitest.
23+
projects: [{ test: { include: ['test/**/*.test.{js,ts,mjs,mts,cjs}'] } }],
1924
include: ['test/**/*.test.{js,ts,mjs,mts,cjs}'],
25+
exclude: [
26+
'**/node_modules/**',
27+
'**/dist/**',
28+
'**/out/**',
29+
'**/.cache/**',
30+
'**/.claude/**',
31+
],
2032
reporters: ['default'],
33+
// Vitest 4 moved poolOptions.threads.* to top-level. Keeping
34+
// single-threaded under coverage for deterministic v8 instrumentation.
2135
pool: 'threads',
22-
poolOptions: {
23-
threads: {
24-
singleThread: isCoverageEnabled,
25-
maxThreads: isCoverageEnabled ? 1 : 16,
26-
minThreads: isCoverageEnabled ? 1 : 2,
27-
isolate: false,
28-
useAtomics: true,
29-
},
30-
},
36+
isolate: false,
37+
maxWorkers: isCoverageEnabled ? 1 : 16,
38+
minWorkers: isCoverageEnabled ? 1 : 2,
3139
testTimeout: 10_000,
3240
hookTimeout: 10_000,
3341
bail: process.env.CI ? 1 : 0,

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@
117117
"@babel/parser": "7.29.3",
118118
"@babel/traverse": "7.29.0",
119119
"@babel/types": "7.29.0",
120-
"@socketsecurity/config": "3.0.1",
121120
"@socketsecurity/lib": "catalog:",
122121
"@vscode/python-extension": "1.0.6",
123122
"ini": "6.0.0",
@@ -128,8 +127,7 @@
128127
"@types/babel__traverse": "7.28.0",
129128
"@types/ini": "4.1.1",
130129
"@types/json-to-ast": "2.1.4",
131-
"@types/micromatch": "4.0.10",
132-
"@types/node": "24.9.2",
130+
"@types/node": "catalog:",
133131
"@types/vscode": "1.118.0",
134132
"@typescript/native-preview": "7.0.0-dev.20260415.1",
135133
"@vitest/coverage-v8": "4.1.5",

pnpm-lock.yaml

Lines changed: 1 addition & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/smoke.test.mts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @fileoverview Smoke test — placeholder to keep the vitest suite
3+
* non-empty until the source has its own coverage. Drop this file
4+
* once `src/` has tests.
5+
*/
6+
7+
import { describe, expect, test } from 'vitest'
8+
9+
describe('smoke', () => {
10+
test('vitest is wired up', () => {
11+
expect(1 + 1).toBe(2)
12+
})
13+
})

vitest.config.mts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @fileoverview Vitest config root anchor — re-exports the canonical
3+
* config under `.config/`. The fleet pattern places configs under
4+
* `.config/`, but vitest's CLI auto-discovers from the cwd; passing
5+
* `--config .config/vitest.config.mts` requires editing the
6+
* fleet-canonical `scripts/test.mts` which is tracked byte-identical
7+
* across the fleet. A root re-export is the cheapest fleet-safe fix.
8+
*/
9+
export { default } from './.config/vitest.config.mts'

0 commit comments

Comments
 (0)