fix(tests): isolate command finalization module mocks

Move the five registered WASM finalization cases into the existing per-file isolated project. Preserve all result, exit-code, observation and cleanup assertions. A preloaded shared CLI graph reproduces three failures before the move; the isolated covered packet passes.

Fixes #4959
This commit is contained in:
morluto committed 2026-10-18 12:42:26 +08:00
1 parent 2c4338db1f
commit 8cbaf6c702
1 file changed
+10 -10
@@ -1,17 +1,17 @@
import { Cli } from "incur";
import { afterEach, expect, it, vi } from "vitest";
import { WasmArtifactService } from "../../../src/application/wasm/WasmArtifactService.js";
import { registerWasmCommands } from "../../../src/cli/wasmCommands.js";
import { wasmArtifactModule } from "../../../src/composition/wasm.js";
import { AnalysisOutputError } from "../../../src/domain/analysisErrorCore.js";
import { ProviderCleanupError } from "../../../src/domain/providerCleanupError.js";
import { err, ok } from "../../../src/domain/result.js";
import { silentLogger } from "../../../src/logger.js";
import { WasmArtifactService } from "../../src/application/wasm/WasmArtifactService.js";
import { registerWasmCommands } from "../../src/cli/wasmCommands.js";
import { wasmArtifactModule } from "../../src/composition/wasm.js";
import { AnalysisOutputError } from "../../src/domain/analysisErrorCore.js";
import { ProviderCleanupError } from "../../src/domain/providerCleanupError.js";
import { err, ok } from "../../src/domain/result.js";
import { silentLogger } from "../../src/logger.js";
import {
wasmArtifactExecution,
wasmArtifactFixture,
} from "../../fixtures/wasm/artifact.js";
} from "../fixtures/wasm/artifact.js";
const host = vi.hoisted(() => ({
listeners: new Map<string, () => void>(),
@@ -24,10 +24,10 @@ const host = vi.hoisted(() => ({
},
}));
vi.mock("../../../src/cli/commandCancellation.js", async (importOriginal) => {
vi.mock("../../src/cli/commandCancellation.js", async (importOriginal) => {
const original =
await importOriginal<
typeof import("../../../src/cli/commandCancellation.js")
typeof import("../../src/cli/commandCancellation.js")
>();
return {
...original,