Skip to content

Commit

Permalink
test: unexpected-error test expects non-colored output
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
candrews committed Aug 25, 2023
1 parent bc717ba commit 32a1094
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions 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';

/**
Expand All @@ -15,7 +15,8 @@ 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' } };
return runCommand('node', ['-r', 'ts-node/register', file], options);
}

it('calls the provided callable', async () => {
Expand Down

0 comments on commit 32a1094

Please sign in to comment.