Merge remote-tracking branch 'origin/master' into worktree/pr504-retarget-latest-master

# Conflicts:
#	docs/event-producer-consumer.md
#	examples/tui-agent/README.md
#	examples/tui-agent/composition.md
#	examples/tui-agent/cordis.yml
#	examples/tui-agent/tests/snapshots/multi-turn-conversation/terminal.expected.txt
#	examples/tui-agent/tests/tui-keyless-smoke.e2e.ts
#	packages/ui/tui/README.md
#	vitest.config.ts
This commit is contained in:
Tianyi Cui
2026-07-22 20:55:12 +08:00
182 changed files with 8016 additions and 576 deletions

View File

@@ -22,6 +22,23 @@ const windowsCoverageExclusions = process.platform === 'win32'
]
: []
const testIncludes = [
'packages/*/*/tests/**/*.spec.{ts,tsx}',
'examples/*/tests/**/*.spec.ts',
'scripts/**/*.spec.ts',
]
// These suites exercise process-global state, process APIs, or timing-sensitive process I/O
// that worker threads cannot isolate reliably under aggregate gate contention.
// Keep the narrow exception in forks while the rest of the inventory avoids per-file processes.
const processBoundTests = [
'packages/bash/bash-local/tests/run.spec.ts',
'packages/context/time-context/tests/time-context.spec.ts',
'packages/llm/llm-pi-ai/tests/adapter.spec.ts',
'packages/ui/app-boot/tests/app-boot.spec.ts',
'packages/workflow/workflow-workerthread/tests/session.spec.ts',
]
export default defineConfig({
// Native path resolution reads each package's nearest tsconfig, but only the root defines
// workspace paths. Keep this plugin pinned to the root map so bare package imports resolve
@@ -32,8 +49,35 @@ export default defineConfig({
test: {
setupFiles: ['./scripts/test-invariants.ts'],
// .tsx: client component specs (jsdom via per-file @vitest-environment pragma).
include: ['packages/*/*/tests/**/*.spec.{ts,tsx}', 'examples/*/tests/**/*.spec.ts', 'scripts/**/*.spec.ts'],
include: testIncludes,
exclude: windowsUnsupportedPackages.map(path => `${path}/tests/**/*.spec.ts`),
// One coverage invocation aggregates both projects. Most suites use threads
// for lower startup/IPC overhead; only explicit process-bound suites fork.
projects: [
{
plugins: [tsconfigPaths({ projects: ['./tsconfig.vitest.json'] })],
test: {
name: 'thread-safe',
pool: 'threads',
setupFiles: ['./scripts/test-invariants.ts'],
include: testIncludes,
exclude: [
...windowsUnsupportedPackages.map(path => `${path}/tests/**/*.spec.ts`),
...processBoundTests,
],
},
},
{
plugins: [tsconfigPaths({ projects: ['./tsconfig.vitest.json'] })],
test: {
name: 'process-bound',
pool: 'forks',
setupFiles: ['./scripts/test-invariants.ts'],
include: processBoundTests,
exclude: windowsUnsupportedPackages.map(path => `${path}/tests/**/*.spec.ts`),
},
},
],
coverage: {
provider: 'v8',
// Coverage measures OUR runtime source. Types-only files carry no