Skip to content
Permalink
Browse files

test: refactor test using assert instead of try/catch

PR-URL: #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>
  • Loading branch information...
juansb827 authored and targos committed Jun 21, 2019
1 parent 32cf344 commit a0f89a28458d0c6ac5bb25f76300ef443f2376e2
Showing with 13 additions and 13 deletions.
  1. +13 −13 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' +
'- }'
});

0 comments on commit a0f89a2

Please sign in to comment.
You can’t perform that action at this time.