From 78ceaad0cc526cfddbfd26db43aa13792c0cf5c6 Mon Sep 17 00:00:00 2001 From: Renegade334 Date: Mon, 9 Nov 2026 19:22:04 +0100 Subject: [PATCH] test: disable FORCE_COLOR when spawning child processes in unit tests Signed-off-by: Renegade334 --- test/unit/ci_preflight_cli.test.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/unit/ci_preflight_cli.test.js b/test/unit/ci_preflight_cli.test.js index c4c88b92..e70f65bf 100644 --- a/test/unit/ci_preflight_cli.test.js +++ b/test/unit/ci_preflight_cli.test.js @@ -102,7 +102,15 @@ function run(t, command, responses, credentials = { `; const result = spawnSync(process.execPath, ['--input-type=module', '--eval', script], { cwd: dir, - env: { ...process.env, XDG_CONFIG_HOME: dir, NCU_VERBOSITY: 'NONE' }, + env: { + ...process.env, + XDG_CONFIG_HOME: dir, + NCU_VERBOSITY: 'NONE', + // The node:test harness may run the test process with FORCE_COLOR; + // it needs to be stripped when spawning child processes, otherwise + // stdout/stderr will contain ANSI color codes and the assertions fail. + FORCE_COLOR: undefined, + }, encoding: 'utf8', timeout: 10000 });