mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
assert: fix throws and doesNotThrow stack frames
The stack frames from .throws and .doesNotThrow got included even though that was not intended. PR-URL: https://github.com/nodejs/node/pull/17703 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
85d5885f52
commit
d9171fef3f
@ -242,7 +242,7 @@ function innerThrows(shouldThrow, block, expected, message) {
|
||||
expected,
|
||||
operator: 'throws',
|
||||
message: `Missing expected exception${details}`,
|
||||
stackStartFn: innerThrows
|
||||
stackStartFn: assert.throws
|
||||
});
|
||||
}
|
||||
if (expected && expectedException(actual, expected) === false) {
|
||||
@ -256,7 +256,7 @@ function innerThrows(shouldThrow, block, expected, message) {
|
||||
expected,
|
||||
operator: 'doesNotThrow',
|
||||
message: `Got unwanted exception${details}\n${actual.message}`,
|
||||
stackStartFn: innerThrows
|
||||
stackStartFn: assert.doesNotThrow
|
||||
});
|
||||
}
|
||||
throw actual;
|
||||
|
@ -634,6 +634,7 @@ testAssertionMessage({ a: NaN, b: Infinity, c: -Infinity },
|
||||
} catch (e) {
|
||||
threw = true;
|
||||
assert.strictEqual(e.message, 'Missing expected exception.');
|
||||
assert.ok(!e.stack.includes('throws'), e.stack);
|
||||
}
|
||||
assert.ok(threw);
|
||||
}
|
||||
@ -678,6 +679,7 @@ try {
|
||||
threw = true;
|
||||
assert.ok(e.message.includes(rangeError.message));
|
||||
assert.ok(e instanceof assert.AssertionError);
|
||||
assert.ok(!e.stack.includes('doesNotThrow'), e.stack);
|
||||
}
|
||||
assert.ok(threw);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user