mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 00:20:08 +01:00
assert: resolve TODO and rename function
PR-URL: https://github.com/nodejs/node/pull/59451 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
6626b16dd8
commit
91f035e597
|
|
@ -83,7 +83,7 @@ function lazyLoadComparison() {
|
|||
// AssertionError's when particular conditions are not met. The
|
||||
// assert module must conform to the following interface.
|
||||
|
||||
const assert = module.exports = ok;
|
||||
module.exports = assert;
|
||||
|
||||
const NO_EXCEPTION_SENTINEL = {};
|
||||
|
||||
|
|
@ -186,8 +186,8 @@ assert.AssertionError = AssertionError;
|
|||
* @param {...any} args
|
||||
* @returns {void}
|
||||
*/
|
||||
function ok(...args) {
|
||||
innerOk(ok, args.length, ...args);
|
||||
function assert(...args) {
|
||||
innerOk(assert, args.length, ...args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -890,10 +890,8 @@ function strict(...args) {
|
|||
innerOk(strict, args.length, ...args);
|
||||
}
|
||||
|
||||
// TODO(aduh95): take `ok` from `Assert.prototype` instead of a self-ref in a next major.
|
||||
assert.ok = assert;
|
||||
ArrayPrototypeForEach([
|
||||
'fail', 'equal', 'notEqual', 'deepEqual', 'notDeepEqual',
|
||||
'ok', 'fail', 'equal', 'notEqual', 'deepEqual', 'notDeepEqual',
|
||||
'deepStrictEqual', 'notDeepStrictEqual', 'strictEqual',
|
||||
'notStrictEqual', 'partialDeepStrictEqual', 'match', 'doesNotMatch',
|
||||
'throws', 'rejects', 'doesNotThrow', 'doesNotReject', 'ifError',
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ assert.strictEqual(
|
|||
code: 'ENOENT',
|
||||
name: 'Error',
|
||||
message: /^ENOENT: no such file or directory, access/,
|
||||
stack: /at async ok\.rejects/
|
||||
stack: /at async assert\.rejects/
|
||||
}
|
||||
).then(common.mustCall());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user