Skip to content

Commit

Permalink
fixup! assert: differentiate cases where cause is undefined or mi…
Browse files Browse the repository at this point in the history
…ssing
  • Loading branch information
aduh95 committed Nov 6, 2024
1 parent 6003a3e commit ec38506
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/parallel/test-assert-deep-with-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ const defaultStartMessage = 'Expected values to be strictly deep-equal:\n' +

test('Handle error causes', () => {
assert.deepStrictEqual(new Error('a', { cause: new Error('x') }), new Error('a', { cause: new Error('x') }));
assert.deepStrictEqual(new Error('a', { cause: new RangeError('x') }), new Error('a', { cause: new RangeError('x') }));
assert.deepStrictEqual(
new Error('a', { cause: new RangeError('x') }),
new Error('a', { cause: new RangeError('x') }),
);

assert.throws(() => {
assert.deepStrictEqual(new Error('a', { cause: new Error('x') }), new Error('a', { cause: new Error('y') }));
Expand Down

0 comments on commit ec38506

Please sign in to comment.