diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-03-20 02:25:22 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-03-27 01:20:19 +0100 |
commit | 2e6dd93aaa40e9f205a2e84920213effab81bea1 (patch) | |
tree | 8e389efa2af112a5a07fa2d182b3552e0b752aa0 /test/pseudo-tty/test-assert-colors.js | |
parent | d74919cc1a47f4f40766ba7f37ab434db246e700 (diff) | |
download | android-node-v8-2e6dd93aaa40e9f205a2e84920213effab81bea1.tar.gz android-node-v8-2e6dd93aaa40e9f205a2e84920213effab81bea1.tar.bz2 android-node-v8-2e6dd93aaa40e9f205a2e84920213effab81bea1.zip |
assert: fix diff color output
The color output was broken at some point and that was not detected
because it was not tested for properly so far. This makes sure the
colors work again and it adds a regression test as well.
PR-URL: https://github.com/nodejs/node/pull/19464
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/pseudo-tty/test-assert-colors.js')
-rw-r--r-- | test/pseudo-tty/test-assert-colors.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/pseudo-tty/test-assert-colors.js b/test/pseudo-tty/test-assert-colors.js new file mode 100644 index 0000000000..7c5845bdaa --- /dev/null +++ b/test/pseudo-tty/test-assert-colors.js @@ -0,0 +1,18 @@ +'use strict'; +require('../common'); +const assert = require('assert').strict; + +try { + // Activate colors even if the tty does not support colors. + process.env.COLORTERM = '1'; + assert.deepStrictEqual([1, 2], [2, 2]); +} catch (err) { + const expected = 'Input A expected to deepStrictEqual input B:\n' + + '\u001b[32m+ expected\u001b[39m \u001b[31m- actual\u001b[39m\n\n' + + ' [\n' + + '\u001b[31m-\u001b[39m 1,\n' + + '\u001b[32m+\u001b[39m 2,\n' + + ' 2\n' + + ' ]'; + assert.strictEqual(err.message, expected); +} |