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>
This commit is contained in:
parent
54ae530951
commit
9cda6f28c8
@ -4,16 +4,16 @@ const assert = require('assert').strict;
|
|||||||
|
|
||||||
process.env.NODE_DISABLE_COLORS = true;
|
process.env.NODE_DISABLE_COLORS = true;
|
||||||
|
|
||||||
try {
|
assert.throws(
|
||||||
assert.deepStrictEqual({}, { foo: 'bar' });
|
() => {
|
||||||
} catch (error) {
|
assert.deepStrictEqual({}, { foo: 'bar' });
|
||||||
const expected =
|
},
|
||||||
'Expected values to be strictly deep-equal:\n' +
|
{
|
||||||
'+ actual - expected\n' +
|
message: 'Expected values to be strictly deep-equal:\n' +
|
||||||
'\n' +
|
'+ actual - expected\n' +
|
||||||
'+ {}\n' +
|
'\n' +
|
||||||
'- {\n' +
|
'+ {}\n' +
|
||||||
'- foo: \'bar\'\n' +
|
'- {\n' +
|
||||||
'- }';
|
'- foo: \'bar\'\n' +
|
||||||
assert.strictEqual(error.message, expected);
|
'- }'
|
||||||
}
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user