assert: add internal assert.fail()
PR-URL: https://github.com/nodejs/node/pull/26047 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
1c66ad408b
commit
ce65034e63
@ -6,4 +6,10 @@ function assert(value, message) {
|
||||
}
|
||||
}
|
||||
|
||||
function fail(message) {
|
||||
require('assert').fail(message);
|
||||
}
|
||||
|
||||
assert.fail = fail;
|
||||
|
||||
module.exports = assert;
|
||||
|
@ -13,3 +13,5 @@ internalAssert(true, 'fhqwhgads');
|
||||
assert.throws(() => { internalAssert(false); }, assert.AssertionError);
|
||||
assert.throws(() => { internalAssert(false, 'fhqwhgads'); },
|
||||
{ code: 'ERR_ASSERTION', message: 'fhqwhgads' });
|
||||
assert.throws(() => { internalAssert.fail('fhqwhgads'); },
|
||||
{ code: 'ERR_ASSERTION', message: 'fhqwhgads' });
|
||||
|
Loading…
x
Reference in New Issue
Block a user