diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-07-03 02:06:57 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-08-04 10:04:32 +0200 |
commit | 0518b9edf33bfffac53ac5f706694a205ff754a2 (patch) | |
tree | 23b152f429dfadeb65b7ec97ab78b3214547c7ec /test/pseudo-tty/test-assert-colors.js | |
parent | a2ec80851ceff8ba6745d6909c8a2434ddfdf568 (diff) | |
download | android-node-v8-0518b9edf33bfffac53ac5f706694a205ff754a2.tar.gz android-node-v8-0518b9edf33bfffac53ac5f706694a205ff754a2.tar.bz2 android-node-v8-0518b9edf33bfffac53ac5f706694a205ff754a2.zip |
assert: multiple improvements
1) Switched + / - and red / green in diffs. It seems like that style
is more natural to most people.
2) Short primitives do not use the diff anymore. Especially short
numbers can be read well like 1 !== 2. Cases that can not be
displayed like that (e.g., -0 and +0) use the regular diff output.
3) Improved error descriptions. It was not always clear what the
messages stood for. That should now be resolved.
4) Added a position indicator for single lines in case a tty is used
and the line is shorter than the visual columns.
5) Color detection is now done by checking stderr instead of stdout.
PR-URL: https://github.com/nodejs/node/pull/21628
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Diffstat (limited to 'test/pseudo-tty/test-assert-colors.js')
-rw-r--r-- | test/pseudo-tty/test-assert-colors.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/pseudo-tty/test-assert-colors.js b/test/pseudo-tty/test-assert-colors.js index 75d3af5579..cd855dc06e 100644 --- a/test/pseudo-tty/test-assert-colors.js +++ b/test/pseudo-tty/test-assert-colors.js @@ -7,12 +7,12 @@ try { process.env.COLORTERM = '1'; assert.deepStrictEqual([1, 2, 2, 2], [2, 2, 2, 2]); } catch (err) { - const expected = 'Input A expected to strictly deep-equal input B:\n' + - '\u001b[32m+ expected\u001b[39m \u001b[31m- actual\u001b[39m' + + const expected = 'Expected inputs 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[31m-\u001b[39m 1,\n' + - '\u001b[32m+\u001b[39m 2,\n' + + '\u001b[32m+\u001b[39m 1,\n' + + '\u001b[31m-\u001b[39m 2,\n' + ' 2,\n' + '\u001b[34m...\u001b[39m\n' + ' 2\n' + |