0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 23:43:09 +01:00
nodejs/test/pseudo-tty/test-assert-colors.js
Ruben Bridgewater 7f2d2cdc0c
test: always activate colors if necessary
PR-URL: https://github.com/nodejs/node/pull/26264
Refs: https://github.com/nodejs/node/pull/26261
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-03 23:31:43 +01:00

26 lines
813 B
JavaScript

'use strict';
require('../common');
const assert = require('assert').strict;
try {
// Activate colors even if the tty does not support colors.
process.env.COLORTERM = '1';
// Make sure TERM is not set to e.g., 'dumb' and NODE_DISABLE_COLORS is not
// active.
process.env.TERM = 'FOOBAR';
delete process.env.NODE_DISABLE_COLORS;
assert.deepStrictEqual([1, 2, 2, 2], [2, 2, 2, 2]);
} catch (err) {
const expected = 'Expected values to be strictly deep-equal:\n' +
'\u001b[32m+ actual\u001b[39m \u001b[31m- expected\u001b[39m' +
' \u001b[34m...\u001b[39m Lines skipped\n\n' +
' [\n' +
'\u001b[32m+\u001b[39m 1,\n' +
'\u001b[31m-\u001b[39m 2,\n' +
' 2,\n' +
'\u001b[34m...\u001b[39m\n' +
' 2\n' +
' ]';
assert.strictEqual(err.message, expected);
}