diff options
author | Juan Bedoya <juansb827@gmail.com> | 2019-06-21 16:16:49 -0500 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-07-30 06:22:01 -0700 |
commit | 9cda6f28c81a6be6f6a1d0a63ab04a41171aeee9 (patch) | |
tree | b02dae66d0600ab7311ece230113c3afa427216d | |
parent | 54ae5309513b3fa3b9ffa0e03faa70cf22a0bb90 (diff) | |
download | android-node-v8-9cda6f28c81a6be6f6a1d0a63ab04a41171aeee9.tar.gz android-node-v8-9cda6f28c81a6be6f6a1d0a63ab04a41171aeee9.tar.bz2 android-node-v8-9cda6f28c81a6be6f6a1d0a63ab04a41171aeee9.zip |
test: refactor test using assert instead of try/catch
PR-URL: https://github.com/nodejs/node/pull/28346
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
-rw-r--r-- | test/pseudo-tty/test-assert-no-color.js | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/test/pseudo-tty/test-assert-no-color.js b/test/pseudo-tty/test-assert-no-color.js index 9412cdcc95..c4e782b560 100644 --- a/test/pseudo-tty/test-assert-no-color.js +++ b/test/pseudo-tty/test-assert-no-color.js @@ -4,16 +4,16 @@ const assert = require('assert').strict; process.env.NODE_DISABLE_COLORS = true; -try { - assert.deepStrictEqual({}, { foo: 'bar' }); -} catch (error) { - const expected = - 'Expected values to be strictly deep-equal:\n' + - '+ actual - expected\n' + - '\n' + - '+ {}\n' + - '- {\n' + - '- foo: \'bar\'\n' + - '- }'; - assert.strictEqual(error.message, expected); -} +assert.throws( + () => { + assert.deepStrictEqual({}, { foo: 'bar' }); + }, + { + message: 'Expected values to be strictly deep-equal:\n' + + '+ actual - expected\n' + + '\n' + + '+ {}\n' + + '- {\n' + + '- foo: \'bar\'\n' + + '- }' + }); |