From dcfbeec23c1b7efceed44c58d309db7c6c941b7f Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 25 Aug 2023 10:34:38 -0400 Subject: [PATCH] test: unexpected-error test expects non-colored output The assertions in unexpected-error.spec.ts expect the output being tested to not contain ANSI color codes. To ensure that is always the case, set FORCE_COLOR="0" so node doesn't output colors. Without this change, this test will pass or fail depending upon the terminal being used to run the tests. With this change, the test runs consistently. --- test/jest/unit/lib/unexpected-error.spec.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/jest/unit/lib/unexpected-error.spec.ts b/test/jest/unit/lib/unexpected-error.spec.ts index 5d49f89fef..7fc976be82 100644 --- a/test/jest/unit/lib/unexpected-error.spec.ts +++ b/test/jest/unit/lib/unexpected-error.spec.ts @@ -1,5 +1,5 @@ import * as path from 'path'; -import { runCommand } from '../../util/runCommand'; +import { RunCommandOptions, runCommand } from '../../util/runCommand'; import { getFixturePath } from '../../util/getFixturePath'; /** @@ -15,7 +15,13 @@ import { getFixturePath } from '../../util/getFixturePath'; describe('callHandlingUnexpectedErrors', () => { async function runScript(filename: string) { const file = path.resolve(getFixturePath('unexpected-error'), filename); - return runCommand('node', ['-r', 'ts-node/register', file]); + const options: RunCommandOptions = { + env: { + FORCE_COLOR: '0', + PATH: process.env.PATH, + }, + }; + return runCommand('node', ['-r', 'ts-node/register', file], options); } it('calls the provided callable', async () => {