test(cli): preserve Windows runtime paths and failure diagnostics
Supply the system root and temporary directory in isolated Windows CLI environments, while preserving explicit caller overrides. Include captured command output in web acceptance exit-code failures so startup and codec errors remain diagnosable.
This commit is contained in:
@@ -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
|
||||
? {}
|
||||
|
||||
Reference in New Issue
Block a user