diff --git a/tests/acceptance/webModuleCli.test.ts b/tests/acceptance/webModuleCli.test.ts index 36675d794..54463ccb3 100644 --- a/tests/acceptance/webModuleCli.test.ts +++ b/tests/acceptance/webModuleCli.test.ts @@ -35,7 +35,9 @@ cliTest( environment, timeoutMs: 15000, }); - expect(cliResponse.exitCode).toBe(0); + expect(cliResponse.exitCode, cliResponse.stdout + cliResponse.stderr).toBe( + 0, + ); expect(cliResponse.json).toMatchObject({ normalized_result: { engine: null, diff --git a/tests/acceptance/webSourceLocationCli.test.ts b/tests/acceptance/webSourceLocationCli.test.ts index bc063270c..f933d6390 100644 --- a/tests/acceptance/webSourceLocationCli.test.ts +++ b/tests/acceptance/webSourceLocationCli.test.ts @@ -40,7 +40,7 @@ cliTest( }, timeoutMs: 45000, }); - expect(response.exitCode).toBe(0); + expect(response.exitCode, response.stdout + response.stderr).toBe(0); expect(response.json).toMatchObject({ normalized_result: { source: { script_index: 0 }, diff --git a/tests/support/cli/cliFixture.ts b/tests/support/cli/cliFixture.ts index c6babc2f1..012944a9a 100644 --- a/tests/support/cli/cliFixture.ts +++ b/tests/support/cli/cliFixture.ts @@ -1,4 +1,5 @@ import { resolve } from "node:path"; +import { tmpdir } from "node:os"; import { createTestWorkspace, @@ -58,6 +59,15 @@ export const createTestCli = ( cwd: cwd ?? process.cwd(), env: { PATH: process.env.PATH ?? "", + // Native Windows APIs need the system root and a writable temporary + // directory even when the command's application environment is empty. + ...(process.platform === "win32" + ? { + SystemRoot: process.env.SystemRoot, + TEMP: tmpdir(), + TMP: tmpdir(), + } + : {}), ...(compileCache === undefined || environment?.NODE_V8_COVERAGE !== undefined ? {}