0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-28 14:33:11 +01:00
nodejs/test/pseudo-tty/test-assert-colors.js
Giovanni Bucci 4d6d7d644b
assert: make assertion_error use Myers diff algorithm
Fixes: https://github.com/nodejs/node/issues/51733

Co-Authored-By: Pietro Marchini <pietro.marchini94@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/54862
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2024-10-17 16:02:54 +00:00

25 lines
693 B
JavaScript

'use strict';
require('../common');
const assert = require('assert').strict;
assert.throws(() => {
process.env.FORCE_COLOR = '1';
delete process.env.NODE_DISABLE_COLORS;
delete process.env.NO_COLOR;
assert.deepStrictEqual([1, 2, 2, 2, 2], [2, 2, 2, 2, 2]);
}, (err) => {
const expected = 'Expected values to be strictly deep-equal:\n' +
'\x1B[32m+ actual\x1B[39m \x1B[31m- expected\x1B[39m\n' +
'\n' +
'\x1B[39m [\n' +
'\x1B[32m+\x1B[39m 1,\n' +
'\x1B[39m 2,\n' +
'\x1B[39m 2,\n' +
'\x1B[39m 2,\n' +
'\x1B[39m 2,\n' +
'\x1B[31m-\x1B[39m 2\n' +
'\x1B[39m ]\n';
assert.strictEqual(err.message, expected);
return true;
});