test: fix failing assertion
One test did not cause an assertion. By changing the test to use `assert.throws()` all tests have to throw, otherwise the test will fail. PR-URL: https://github.com/nodejs/node/pull/25250 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
dfaa61fa18
commit
8c0290e054
@ -257,16 +257,14 @@ const circular = { y: 1 };
|
|||||||
circular.x = circular;
|
circular.x = circular;
|
||||||
|
|
||||||
function testAssertionMessage(actual, expected, msg) {
|
function testAssertionMessage(actual, expected, msg) {
|
||||||
try {
|
assert.throws(
|
||||||
assert.strictEqual(actual, '');
|
() => assert.strictEqual(actual, ''),
|
||||||
} catch (e) {
|
{
|
||||||
assert.strictEqual(
|
generatedMessage: true,
|
||||||
e.message,
|
message: msg || strictEqualMessageStart +
|
||||||
msg || strictEqualMessageStart +
|
`+ actual - expected\n\n+ ${expected}\n- ''`
|
||||||
`+ actual - expected\n\n+ ${expected}\n- ''`
|
}
|
||||||
);
|
);
|
||||||
assert.ok(e.generatedMessage, 'Message not marked as generated');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testShortAssertionMessage(actual, expected) {
|
function testShortAssertionMessage(actual, expected) {
|
||||||
@ -280,7 +278,7 @@ testShortAssertionMessage(false, 'false');
|
|||||||
testShortAssertionMessage(100, '100');
|
testShortAssertionMessage(100, '100');
|
||||||
testShortAssertionMessage(NaN, 'NaN');
|
testShortAssertionMessage(NaN, 'NaN');
|
||||||
testShortAssertionMessage(Infinity, 'Infinity');
|
testShortAssertionMessage(Infinity, 'Infinity');
|
||||||
testShortAssertionMessage('', '""');
|
testShortAssertionMessage('a', '"a"');
|
||||||
testShortAssertionMessage('foo', '\'foo\'');
|
testShortAssertionMessage('foo', '\'foo\'');
|
||||||
testShortAssertionMessage(0, '0');
|
testShortAssertionMessage(0, '0');
|
||||||
testShortAssertionMessage(Symbol(), 'Symbol()');
|
testShortAssertionMessage(Symbol(), 'Symbol()');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user