mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
dbc4f2f955
Deletes the serialized `subprocess-stub` Vitest project and drops SUBPROCESS_STUB_TESTS from unit-core's exclude, so its two real spawners (client-metro.test.ts, harness.test.ts — corpus-replay.test.ts already left for fuzz-worker in #1994) run un-serialized in the default forks pool per #1823's own kill criterion. Revert if a timeout-shaped failure shows up before 20 consecutive CI runs pass clean. The files stay excluded from the mutation lane (SERIALIZED_TESTS): that exclusion is about mutant-rerun cost, independent of Vitest project structure. Updated the comments/docs/scripts that described the old project by name so none of them assert a project that no longer exists. Claude-Session: https://claude.ai/code/session_015YPgKE1xmjdqh7T1q987DA Co-authored-by: Claude <noreply@anthropic.com>
43 lines
2.1 KiB
TypeScript
43 lines
2.1 KiB
TypeScript
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { defineConfig } from 'vitest/config';
|
|
import { readTestScope, threadHostileTestFiles } from './scripts/mutation/test-scope.ts';
|
|
import { workspaceSourceAliases } from './scripts/mutation/workspace-aliases.ts';
|
|
import { SERIALIZED_TESTS, SETUP_FILES } from './vitest.config.ts';
|
|
|
|
const repoRoot = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
// Workspace-package aliases for the Stryker sandbox (#1490 W0). Stryker copies
|
|
// the tree into .stryker-tmp and symlinks node_modules back to the real repo,
|
|
// so a `@agent-device/*` specifier resolved through pnpm's link escapes the
|
|
// sandbox: mutants written into the sandbox copy never load, and
|
|
// `vitest related` finds no tests for a mutated package file. Aliasing each
|
|
// EXPORTED specifier to its source file — resolved relative to this config,
|
|
// which Stryker copies into the sandbox — keeps resolution inside the mutated
|
|
// tree. Entries come from the shared exports-map reader, never a wildcard, so
|
|
// this cannot resolve package internals the boundary forbids (R11).
|
|
const workspaceAliases = workspaceSourceAliases(repoRoot);
|
|
|
|
// Test scope for the decision-kernel mutation lane (issue #1415).
|
|
//
|
|
// `scripts/mutation/run.ts` derives the per-run scope from Vitest's module graph
|
|
// (`vitest related` over the mutated files) and hands it over through
|
|
// AGENT_DEVICE_MUTATION_TEST_FILES; the fallback is the deterministic unit suite,
|
|
// which keeps `pnpm exec stryker run` usable by hand. Excluded either way: the
|
|
// real-subprocess-spawn tests (SERIALIZED_TESTS — #1823, only `fuzz-worker` still
|
|
// runs them in a serialized Vitest project) and the CLI-capture tests — see
|
|
// scripts/mutation/test-scope.ts for why, and why excluding them cannot hide a
|
|
// surviving mutant.
|
|
const scope = readTestScope();
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: workspaceAliases,
|
|
},
|
|
test: {
|
|
include: scope ?? ['src/**/*.test.ts', 'packages/*/src/**/*.test.ts'],
|
|
exclude: [...SERIALIZED_TESTS, ...threadHostileTestFiles(repoRoot), '**/node_modules/**'],
|
|
setupFiles: [...SETUP_FILES],
|
|
},
|
|
});
|