assert: port common.mustCall() to assert

Fixes: https://github.com/nodejs/node/issues/31392

PR-URL: https://github.com/nodejs/node/pull/31982
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
This commit is contained in:
ConorDavenport 2020-02-27 11:41:05 +00:00 committed by James M Snell
parent 01e158c600
commit 50d28d4b3a
10 changed files with 388 additions and 3 deletions

View file

@ -51,6 +51,7 @@ const { NativeModule } = require('internal/bootstrap/loaders');
const { isError } = require('internal/util');
const errorCache = new Map();
const CallTracker = require('internal/assert/calltracker');
let isDeepEqual;
let isDeepStrictEqual;
@ -928,6 +929,8 @@ assert.doesNotMatch = function doesNotMatch(string, regexp, message) {
internalMatch(string, regexp, message, doesNotMatch);
};
assert.CallTracker = CallTracker;
// Expose a strict only variant of assert
function strict(...args) {
innerOk(strict, args.length, ...args);