assert: resolve TODO and rename function
Some checks failed
Coverage Windows / coverage-windows (push) Waiting to run
Linters / lint-addon-docs (push) Failing after 1m12s
Coverage Linux / coverage-linux (push) Failing after 1m10s
Coverage Linux (without intl) / coverage-linux-without-intl (push) Failing after 1m15s
Test and upload documentation to artifacts / build-docs (push) Failing after 5m7s
Linters / lint-yaml (push) Successful in 2m43s
Linters / lint-cpp (push) Successful in 3m44s
Linters / format-cpp (push) Has been skipped
Linters / lint-py (push) Successful in 2m41s
Linters / lint-sh (push) Failing after 1m26s
Linters / lint-codeowners (push) Failing after 1m3s
Linters / lint-pr-url (push) Has been skipped
Linters / lint-readme (push) Successful in 1m27s
Notify on Push / Notify on Force Push on `main` (push) Has been skipped
Notify on Push / Notify on Push on `main` that lacks metadata (push) Has been skipped
Scorecard supply-chain security / Scorecard analysis (push) Failing after 52s
Linters / lint-js-and-md (push) Successful in 12m44s

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:
Antoine du Hamel 2025-08-14 11:51:13 +02:00 committed by GitHub
parent 6626b16dd8
commit 91f035e597
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 7 deletions

View file

@ -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',

View file

@ -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());