Skip to content

Commit 0d28b4b

Browse files
cjihrigMylesBorins
authored andcommitted
test: disable colors in test-assert-checktag.js
When test/parallel/test-assert-checktag.js is run with a TTY as stdout, color codes in assertion messages cause the test to fail. This commit disables colors when stdout is a TTY. PR-URL: #20695 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent dccbc3a commit 0d28b4b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/parallel/test-assert-checktag.js

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
require('../common');
33
const assert = require('assert');
44

5+
// Disable colored output to prevent color codes from breaking assertion
6+
// message comparisons. This should only be an issue when process.stdout
7+
// is a TTY.
8+
if (process.stdout.isTTY)
9+
process.env.NODE_DISABLE_COLORS = '1';
10+
511
// Turn off no-restricted-properties because we are testing deepEqual!
612
/* eslint-disable no-restricted-properties */
713

0 commit comments

Comments
 (0)