Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: disable colors in test-assert.js
When test/parallel/test-assert.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.

Fixes: #18967
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>
  • Loading branch information
cjihrig committed May 15, 2018
commit b5704859d043baeeda916ee4e435c06f5e2569e6
6 changes: 6 additions & 0 deletions test/parallel/test-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const { writeFileSync, unlinkSync } = require('fs');
const { inspect } = require('util');
const a = assert;

// Disable colored output to prevent color codes from breaking assertion
// message comparisons. This should only be an issue when process.stdout
// is a TTY.
if (process.stdout.isTTY)
process.env.NODE_DISABLE_COLORS = '1';

const start = 'Input A expected to strictly deep-equal input B:';
const actExp = '+ expected - actual';

Expand Down