From 84f3401dcfed1e5e5343318e366fa74d51a7f64c Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Mon, 9 Nov 2026 14:58:24 +0800 Subject: [PATCH] perf(tests): reuse CLI worker for Evidence bundle data cases --- .../cli/evidenceBundleCommands.test.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/boundary/cli/evidenceBundleCommands.test.ts b/tests/boundary/cli/evidenceBundleCommands.test.ts index 16d4a8c704..d7a59fe659 100644 --- a/tests/boundary/cli/evidenceBundleCommands.test.ts +++ b/tests/boundary/cli/evidenceBundleCommands.test.ts @@ -22,7 +22,7 @@ import { updateResidualUnknown, } from "../../../src/domain/residualUnknown.js"; import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js"; -import { cliTest } from "../../support/cli/cliFixture.js"; +import { cliTest, runFileCli } from "../../support/cli/cliFixture.js"; const revisionBundle = () => { const records = ["open", "investigate"].map((operation) => @@ -78,7 +78,7 @@ cliTest( [["compare", "bundle.json", ""], "right"], [["evidence-export", "missing.json", ""], "output"], ] as const) { - const result = await cli.run({ + const result = await runFileCli(cli, { arguments: [...args, "--json"], cwd: root, }); @@ -138,7 +138,7 @@ cliTest( ["evidence-export", { source: " bundle.json", output: " exported.json" }], ["compare", { left: " bundle.json", right: " other.json" }], ] as const) { - const result = await cli.run({ + const result = await runFileCli(cli, { arguments: [command, "--schema", "--json"], }); expect(result.exitCode, result.stderr).toBe(0); @@ -246,7 +246,7 @@ cliTest.for([ : operation === "compare-left" ? ["compare", path, canonical] : ["compare", canonical, path]; - const result = await cli.run({ + const result = await runFileCli(cli, { arguments: [...arguments_, "--json"], environment: { REA_LOG_LEVEL: "silent" }, }); @@ -325,7 +325,7 @@ cliTest( await writeFile(source, JSON.stringify(bundle)); for (const full of [false, true]) { const output = join(root, `${label}-${String(full)}.json`); - const result = await cli.run({ + const result = await runFileCli(cli, { arguments: [ "evidence-export", source, @@ -387,7 +387,7 @@ cliTest( { ...bundle, unknowns: bundle.unknowns.slice(1) }, ]) { await writeFile(path, JSON.stringify(invalid)); - const result = await cli.run({ + const result = await runFileCli(cli, { arguments: ["evidence-import", path, "--json"], }); expect(result.exitCode).toBe(1); @@ -414,7 +414,7 @@ cliTest( ); await writeFile(path, JSON.stringify(createEvidenceBundle([record]))); - const output = await cli.run({ + const output = await runFileCli(cli, { arguments: [ "inspect-evidence-bundle", JSON.stringify({ path, detail: "complete" }), @@ -466,12 +466,14 @@ cliTest( "--filter-output", "records.0.normalized_result", ]; - const json = await cli.run({ arguments: [...base, "--json"] }); + const json = await runFileCli(cli, { arguments: [...base, "--json"] }); expect(json.exitCode, json.stderr).toBe(0); expect(json.stdout).toContain(JSON.stringify(result.text)); expect(json.stdout).toContain(JSON.stringify(result.type)); expect(json.stdout).toContain(JSON.stringify(result.literal)); - const markdown = await cli.run({ arguments: [...base, "--format", "md"] }); + const markdown = await runFileCli(cli, { + arguments: [...base, "--format", "md"], + }); expect(markdown.exitCode, markdown.stderr).toBe(0); expect(markdown.stdout).toContain("left\\|right\\\\tail
next"); expect(markdown.stdout).toContain("List<string>"); @@ -495,7 +497,7 @@ cliTest( records: [record], }; await writeFile(path, JSON.stringify(bundle)); - const imported = await cli.run({ + const imported = await runFileCli(cli, { arguments: ["evidence-import", path, "--json"], }); expect(imported.exitCode).toBe(1);