Skip to content

Commit f20ee3e

Browse files
aduh95panva
authored andcommitted
assert: resolve TODO and rename function
PR-URL: nodejs#59451 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Ulises Gascón <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 1638351 commit f20ee3e

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

lib/assert.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function lazyLoadComparison() {
8383
// AssertionError's when particular conditions are not met. The
8484
// assert module must conform to the following interface.
8585

86-
const assert = module.exports = ok;
86+
module.exports = assert;
8787

8888
const NO_EXCEPTION_SENTINEL = {};
8989

@@ -186,8 +186,8 @@ assert.AssertionError = AssertionError;
186186
* @param {...any} args
187187
* @returns {void}
188188
*/
189-
function ok(...args) {
190-
innerOk(ok, args.length, ...args);
189+
function assert(...args) {
190+
innerOk(assert, args.length, ...args);
191191
}
192192

193193
/**
@@ -890,10 +890,8 @@ function strict(...args) {
890890
innerOk(strict, args.length, ...args);
891891
}
892892

893-
// TODO(aduh95): take `ok` from `Assert.prototype` instead of a self-ref in a next major.
894-
assert.ok = assert;
895893
ArrayPrototypeForEach([
896-
'fail', 'equal', 'notEqual', 'deepEqual', 'notDeepEqual',
894+
'ok', 'fail', 'equal', 'notEqual', 'deepEqual', 'notDeepEqual',
897895
'deepStrictEqual', 'notDeepStrictEqual', 'strictEqual',
898896
'notStrictEqual', 'partialDeepStrictEqual', 'match', 'doesNotMatch',
899897
'throws', 'rejects', 'doesNotThrow', 'doesNotReject', 'ifError',

test/parallel/test-fs-promises.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ assert.strictEqual(
5858
code: 'ENOENT',
5959
name: 'Error',
6060
message: /^ENOENT: no such file or directory, access/,
61-
stack: /at async ok\.rejects/
61+
stack: /at async assert\.rejects/
6262
}
6363
).then(common.mustCall());
6464

0 commit comments

Comments
 (0)