Skip to content

Commit 85b2070

Browse files
committed
test: fix test runner colored output test
1 parent 431f32e commit 85b2070

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

test/fixtures/test-runner/output/arbitrary-output-colored-1.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
'use strict';
22

33
const test = require('node:test');
4+
5+
// Make this test OS-independent by overriding stdio getColorDepth().
6+
process.stdout.getColorDepth = () => 8;
7+
process.stderr.getColorDepth = () => 8;
8+
49
console.log({ foo: 'bar' });
510
test('passing test', () => {
611
console.log(1);

test/fixtures/test-runner/output/arbitrary-output-colored.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ const fixtures = require('../../../common/fixtures');
66

77
(async function run() {
88
const test = fixtures.path('test-runner/output/arbitrary-output-colored-1.js');
9-
await once(spawn(process.execPath, ['--test', test], { stdio: 'inherit', env: { FORCE_COLOR: 1 } }), 'exit');
10-
await once(spawn(process.execPath, ['--test', '--test-reporter', 'tap', test], { stdio: 'inherit', env: { FORCE_COLOR: 1 } }), 'exit');
9+
await once(spawn(process.execPath, ['--test', test], { stdio: 'inherit' }), 'exit');
10+
await once(spawn(process.execPath, ['--test', '--test-reporter', 'tap', test], { stdio: 'inherit' }), 'exit');
1111
})().then(common.mustCall());

0 commit comments

Comments
 (0)