


























@@ -2,11 +2,12 @@ import fs from "node:fs/promises";
22import os from "node:os";
33import path from "node:path";
44import { setTimeout as sleep } from "node:timers/promises";
5-import { afterEach, describe, expect, it } from "vitest";
5+import { afterEach, describe, expect, it, vi } from "vitest";
66import { validateQaEvidenceSummaryJson } from "./evidence-summary.js";
77import { readQaScenarioById, type QaSeedScenarioWithSource } from "./scenario-catalog.js";
88import { createTempDirHarness } from "./temp-dir.test-helper.js";
99import {
10+qaTestFileScenarioRunnerTesting,
1011runQaTestFileScenarios,
1112type QaScenarioCommandExecution,
1213} from "./test-file-scenario-runner.js";
@@ -429,6 +430,29 @@ describe("qa test file scenario runner", () => {
429430}
430431});
431432433+it("force-kills Windows scenario command trees when graceful taskkill fails", () => {
434+const runTaskkill = vi
435+.fn()
436+.mockReturnValueOnce({ status: 1 })
437+.mockReturnValueOnce({ status: 0 });
438+439+expect(
440+qaTestFileScenarioRunnerTesting.killQaScenarioWindowsProcessTree(
441+12345,
442+"SIGTERM",
443+runTaskkill,
444+),
445+).toBe(true);
446+expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/pid", "12345", "/T"], {
447+stdio: "ignore",
448+windowsHide: true,
449+});
450+expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/pid", "12345", "/T", "/F"], {
451+stdio: "ignore",
452+windowsHide: true,
453+});
454+});
455+432456it("fails script scenarios that exit cleanly after timeout termination", async () => {
433457const repoRoot = process.cwd();
434458const tempRoot = await makeTempDir("qa-script-timeout-clean-exit-");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。