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 <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
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

Lines changed: 6 additions & 0 deletions
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)