test: isolate module mocks without changing test groups

This commit is contained in:
morluto
2026-10-24 08:45:46 +08:00
parent 1d2b26e2d5
commit 673a659074
2 changed files with 22 additions and 1 deletions
+8 -1
View File
@@ -11,12 +11,15 @@ export const SOURCE_TEST_PROJECTS = [
name: "services",
group: "source",
include: ["src/application/**/*.test.ts"],
exclude: ["src/application/EvidenceBundleFiles.test.ts"],
},
{
name: "adapters",
group: "source",
include: [
"src/*.test.ts",
// This application fixture replaces a module and needs a fresh graph.
"src/application/EvidenceBundleFiles.test.ts",
"src/{android,apkSignature,apktool,jeb,adb,artifacts,browser,config,cutter,dotnet,electron,erlang,evm,firmware,flutter,pcap,ghidra,go,gpu,hopper,ida,inspector,javascript,main,native,process,python,reference,rust,server,sqlite,wasm,windows}/**/*.test.ts",
],
},
@@ -66,6 +69,7 @@ export const BUILT_TEST_PROJECTS = [
name: "mcp-boundary",
group: "built",
include: ["tests/boundary/mcp/**/*.test.ts"],
exclude: ["tests/boundary/mcp/javascriptAnalysisCancellation.test.ts"],
},
{
name: "acceptance",
@@ -75,7 +79,10 @@ export const BUILT_TEST_PROJECTS = [
{
name: "process-global",
group: "built",
include: ["tests/process-global/**/*.test.ts"],
include: [
"tests/process-global/**/*.test.ts",
"tests/boundary/mcp/javascriptAnalysisCancellation.test.ts",
],
},
];
@@ -143,6 +143,20 @@ describe("canonical test-project ownership", () => {
});
describe("test module isolation", () => {
it.each([
["src/application/EvidenceBundleFiles.test.ts", "adapters", "source"],
[
"tests/boundary/mcp/javascriptAnalysisCancellation.test.ts",
"process-global",
"built",
],
])(
"keeps %s isolated without changing its preparation group",
(path, name, group) => {
expect(projectForTest(path)).toMatchObject({ name, group });
},
);
it("keeps module mocks out of projects that share one module graph", async () => {
// A mock registered after another file in the same worker loaded the
// module never applies, so the test's outcome depends on file scheduling.