@@ -431,27 +431,44 @@ describe("qa test file scenario runner", () => {
|
431 | 431 | }); |
432 | 432 | |
433 | 433 | it("force-kills Windows scenario command trees when graceful taskkill fails", () => { |
| 434 | +const originalSystemRoot = process.env.SystemRoot; |
| 435 | +const originalWindir = process.env.WINDIR; |
| 436 | +process.env.SystemRoot = "C:\\Windows"; |
| 437 | +delete process.env.WINDIR; |
434 | 438 | const runTaskkill = vi |
435 | 439 | .fn() |
436 | 440 | .mockReturnValueOnce({ status: 1 }) |
437 | 441 | .mockReturnValueOnce({ status: 0 }); |
438 | 442 | |
439 | | -expect( |
440 | | -qaTestFileScenarioRunnerTesting.killQaScenarioWindowsProcessTree( |
441 | | -12345, |
442 | | -"SIGTERM", |
443 | | -runTaskkill, |
444 | | -), |
445 | | -).toBe(true); |
446 | | -const taskkillPath = path.win32.join("C:\\Windows", "System32", "taskkill.exe"); |
447 | | -expect(runTaskkill).toHaveBeenNthCalledWith(1, taskkillPath, ["/pid", "12345", "/T"], { |
448 | | -stdio: "ignore", |
449 | | -windowsHide: true, |
450 | | -}); |
451 | | -expect(runTaskkill).toHaveBeenNthCalledWith(2, taskkillPath, ["/pid", "12345", "/T", "/F"], { |
452 | | -stdio: "ignore", |
453 | | -windowsHide: true, |
454 | | -}); |
| 443 | +try { |
| 444 | +expect( |
| 445 | +qaTestFileScenarioRunnerTesting.killQaScenarioWindowsProcessTree( |
| 446 | +12345, |
| 447 | +"SIGTERM", |
| 448 | +runTaskkill, |
| 449 | +), |
| 450 | +).toBe(true); |
| 451 | +const taskkillPath = path.win32.join("C:\\Windows", "System32", "taskkill.exe"); |
| 452 | +expect(runTaskkill).toHaveBeenNthCalledWith(1, taskkillPath, ["/pid", "12345", "/T"], { |
| 453 | +stdio: "ignore", |
| 454 | +windowsHide: true, |
| 455 | +}); |
| 456 | +expect(runTaskkill).toHaveBeenNthCalledWith(2, taskkillPath, ["/pid", "12345", "/T", "/F"], { |
| 457 | +stdio: "ignore", |
| 458 | +windowsHide: true, |
| 459 | +}); |
| 460 | +} finally { |
| 461 | +if (originalSystemRoot === undefined) { |
| 462 | +delete process.env.SystemRoot; |
| 463 | +} else { |
| 464 | +process.env.SystemRoot = originalSystemRoot; |
| 465 | +} |
| 466 | +if (originalWindir === undefined) { |
| 467 | +delete process.env.WINDIR; |
| 468 | +} else { |
| 469 | +process.env.WINDIR = originalWindir; |
| 470 | +} |
| 471 | +} |
455 | 472 | }); |
456 | 473 | |
457 | 474 | it("fails script scenarios that exit cleanly after timeout termination", async () => { |
|