Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! add more tests
  • Loading branch information
BridgeAR committed Oct 7, 2025
commit 67d2b7b752ae3ff9159ace8ae6416d62e1940186
18 changes: 18 additions & 0 deletions test/parallel/test-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,24 @@ test('Ambiguous error messages fail', () => {
);
});

test('Faulty message functions', () => {
assert.throws(
() => assert.doesNotMatch('foo', /foo/, (a, b) => 123),
{
code: 'ERR_ASSERTION',
message: "'foo' doesNotMatch /foo/"
}
);

assert.throws(
() => assert.match('foo', /123/, (a, b) => { new Error('baz'); }),
{
code: 'ERR_ASSERTION',
message: "'foo' match /123/"
}
);
});

test('Functions as error message', () => {
function errorMessage(actual, expected) {
return `Nice message including ${actual} and ${expected}`;
Expand Down
Loading