Skip to content

Commit

Permalink
test: refactor test using assert instead of try/catch
Browse files Browse the repository at this point in the history
PR-URL: nodejs#28346
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
  • Loading branch information
juansb827 authored and Trott committed Jul 30, 2019
1 parent 54ae530 commit 9cda6f2
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions test/pseudo-tty/test-assert-no-color.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 9cda6f2

Please sign in to comment.