2026-06-11 10:52:45 +08:00
|
|
|
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
|
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
|
|
2026-07-17 12:30:16 +08:00
|
|
|
const windowsUnsupportedPackages = process.platform === 'win32'
|
|
|
|
|
? [
|
|
|
|
|
'packages/bash/*',
|
|
|
|
|
'packages/hooks/*',
|
|
|
|
|
'packages/sandbox/sandbox-local',
|
|
|
|
|
'packages/sdk/create-sdk',
|
|
|
|
|
'packages/sdk/helper',
|
|
|
|
|
]
|
|
|
|
|
: []
|
|
|
|
|
|
2026-07-22 13:47:24 +08:00
|
|
|
// These files retain 100% per-file coverage on POSIX, where their process-pipe and terminal timing
|
|
|
|
|
// tests are deterministic; Windows skips those cases and must not fail solely on their uncovered paths.
|
|
|
|
|
const windowsCoverageExclusions = process.platform === 'win32'
|
|
|
|
|
? [
|
|
|
|
|
'packages/lsp/lsp-local/src/connection.ts',
|
|
|
|
|
'packages/lsp/lsp-local/src/index.ts',
|
|
|
|
|
'packages/lsp/lsp-local/src/instance.ts',
|
|
|
|
|
'packages/ui/tui/src/index.ts',
|
|
|
|
|
]
|
|
|
|
|
: []
|
|
|
|
|
|
2026-06-11 10:52:45 +08:00
|
|
|
export default defineConfig({
|
2026-07-12 23:41:59 +08:00
|
|
|
// Native path resolution reads each package's nearest tsconfig, but only the root defines
|
2026-07-13 23:27:00 +08:00
|
|
|
// workspace paths. Keep this plugin pinned to the root map so unbuilt bare package imports resolve
|
|
|
|
|
// to source; native resolution would fall through to absent `lib/` outputs.
|
2026-06-17 23:41:18 +08:00
|
|
|
plugins: [tsconfigPaths({ projects: ['./tsconfig.json'] })],
|
2026-06-11 10:52:45 +08:00
|
|
|
test: {
|
2026-07-19 22:13:50 +08:00
|
|
|
setupFiles: ['./scripts/test-invariants.ts'],
|
2026-07-14 23:09:01 +08:00
|
|
|
include: ['packages/*/*/tests/**/*.spec.ts', 'examples/*/tests/**/*.spec.ts', 'scripts/**/*.spec.ts'],
|
2026-07-17 12:30:16 +08:00
|
|
|
exclude: windowsUnsupportedPackages.map(path => `${path}/tests/**/*.spec.ts`),
|
Enforce 100% per-file test coverage on packages/*/src
vitest coverage (v8 provider) with per-file 100% thresholds for
statements, branches, functions, and lines. Scope: our runtime source
only — types-only files, vendor/ (upstream code), and examples/
(exercised by the demo smoke test) are excluded. yarn test:coverage
runs the gate.
59 tests added to close every gap: llm generate-waterfall and adapter
disposal; assembler edge protocol (duplicate block-start, stragglers
after block-end, id fallback, usage omission, invariant violation);
the whole Inbox surface incl. the wakeup-overwrite race; LoopAgent
disposed-state throws and double-stop idempotence; config-driven agent
creation; loop backstop catches (throwing turn-start/turn-end
listeners, non-Error throws, non-JSON tool arguments); system-prompt
dynamic sections and disposer paths; tools errorMessage fallbacks and
the full schema-DSL emission matrix. Genuinely unreachable defensive
guards carry /* v8 ignore */ comments with stated reasons rather than
deletion (132 tests total).
2026-06-11 14:58:36 +08:00
|
|
|
coverage: {
|
|
|
|
|
provider: 'v8',
|
|
|
|
|
// Coverage measures OUR runtime source. Types-only files carry no
|
|
|
|
|
// executable code; vendor/ and examples/ are out of scope (examples are
|
|
|
|
|
// exercised by the demo smoke test instead).
|
Reorganize packages into a modular hierarchy
Move the 18 flat packages/<name> packages into role-grouped dirs:
core/, llm/, bash/, session-persistence/, ui/, support/. Group dirs are
pure containers; each package keeps its @deepseek-ai/dsh-* name.
Collapse the per-package tsconfig paths maps (base + typecheck) into one
@deepseek-ai/dsh-* wildcard with a candidate per group, and derive the
publint list from the hierarchy. Update all depth-coupled globs/configs
(workspace, tsdown, vitest, eslint, knip, tsconfig includes/refs,
per-package tsconfigs, generators, doc-script scopes, type-equiv manifest)
and the cross-package/script relative imports in tests.
Fix doc-typecheck's workspacePaths() to parse tsconfig JSONC via the
TypeScript API instead of a regex comment-strip, which corrupted the
new wildcard `/*/` path candidates.
WIP: doc cross-links and package/RFC docs still to update.
2026-06-20 22:55:20 +08:00
|
|
|
include: ['packages/*/*/src/**/*.ts'],
|
2026-07-13 23:27:00 +08:00
|
|
|
// Types-only files have no runtime coverage. Importing self-executing bins/workers would boot
|
|
|
|
|
// them inside the unit process, so real subprocess/Worker tests cover their thin entry glue.
|
2026-07-17 12:30:16 +08:00
|
|
|
exclude: [
|
|
|
|
|
'packages/*/*/src/types.ts',
|
|
|
|
|
'packages/*/*/src/bin.ts',
|
|
|
|
|
'packages/*/*/src/worker.ts',
|
|
|
|
|
...windowsUnsupportedPackages.map(path => `${path}/src/**/*.ts`),
|
2026-07-22 13:47:24 +08:00
|
|
|
...windowsCoverageExclusions,
|
2026-07-17 12:30:16 +08:00
|
|
|
],
|
2026-07-04 16:02:39 +08:00
|
|
|
// 100% or it doesn't merge (docs/testing.md: excessive tests are welcome).
|
Enforce 100% per-file test coverage on packages/*/src
vitest coverage (v8 provider) with per-file 100% thresholds for
statements, branches, functions, and lines. Scope: our runtime source
only — types-only files, vendor/ (upstream code), and examples/
(exercised by the demo smoke test) are excluded. yarn test:coverage
runs the gate.
59 tests added to close every gap: llm generate-waterfall and adapter
disposal; assembler edge protocol (duplicate block-start, stragglers
after block-end, id fallback, usage omission, invariant violation);
the whole Inbox surface incl. the wakeup-overwrite race; LoopAgent
disposed-state throws and double-stop idempotence; config-driven agent
creation; loop backstop catches (throwing turn-start/turn-end
listeners, non-Error throws, non-JSON tool arguments); system-prompt
dynamic sections and disposer paths; tools errorMessage fallbacks and
the full schema-DSL emission matrix. Genuinely unreachable defensive
guards carry /* v8 ignore */ comments with stated reasons rather than
deletion (132 tests total).
2026-06-11 14:58:36 +08:00
|
|
|
// Per-file so a well-covered big file can't subsidize a bare one.
|
2026-07-19 22:50:49 +08:00
|
|
|
// Every v8 ignore comment must carry a reason — see the quality-gates Agent Note
|
|
|
|
|
// (.agents/notes/implemented/process/2026-06-11-quality-gates.md).
|
Enforce 100% per-file test coverage on packages/*/src
vitest coverage (v8 provider) with per-file 100% thresholds for
statements, branches, functions, and lines. Scope: our runtime source
only — types-only files, vendor/ (upstream code), and examples/
(exercised by the demo smoke test) are excluded. yarn test:coverage
runs the gate.
59 tests added to close every gap: llm generate-waterfall and adapter
disposal; assembler edge protocol (duplicate block-start, stragglers
after block-end, id fallback, usage omission, invariant violation);
the whole Inbox surface incl. the wakeup-overwrite race; LoopAgent
disposed-state throws and double-stop idempotence; config-driven agent
creation; loop backstop catches (throwing turn-start/turn-end
listeners, non-Error throws, non-JSON tool arguments); system-prompt
dynamic sections and disposer paths; tools errorMessage fallbacks and
the full schema-DSL emission matrix. Genuinely unreachable defensive
guards carry /* v8 ignore */ comments with stated reasons rather than
deletion (132 tests total).
2026-06-11 14:58:36 +08:00
|
|
|
thresholds: {
|
|
|
|
|
perFile: true,
|
|
|
|
|
statements: 100,
|
|
|
|
|
branches: 100,
|
|
|
|
|
functions: 100,
|
|
|
|
|
lines: 100,
|
|
|
|
|
},
|
2026-07-06 01:47:13 +08:00
|
|
|
reporter: process.env.CI ? ['text'] : ['text', 'html'],
|
Enforce 100% per-file test coverage on packages/*/src
vitest coverage (v8 provider) with per-file 100% thresholds for
statements, branches, functions, and lines. Scope: our runtime source
only — types-only files, vendor/ (upstream code), and examples/
(exercised by the demo smoke test) are excluded. yarn test:coverage
runs the gate.
59 tests added to close every gap: llm generate-waterfall and adapter
disposal; assembler edge protocol (duplicate block-start, stragglers
after block-end, id fallback, usage omission, invariant violation);
the whole Inbox surface incl. the wakeup-overwrite race; LoopAgent
disposed-state throws and double-stop idempotence; config-driven agent
creation; loop backstop catches (throwing turn-start/turn-end
listeners, non-Error throws, non-JSON tool arguments); system-prompt
dynamic sections and disposer paths; tools errorMessage fallbacks and
the full schema-DSL emission matrix. Genuinely unreachable defensive
guards carry /* v8 ignore */ comments with stated reasons rather than
deletion (132 tests total).
2026-06-11 14:58:36 +08:00
|
|
|
},
|
2026-06-11 10:52:45 +08:00
|
|
|
},
|
|
|
|
|
})
|