MCPcopy Index your code
hub / github.com/nodejs/node / assert

Method assert

lib/internal/test_runner/test.js:329–359  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

327 }
328
329 get assert() {
330 if (this.#assert === undefined) {
331 const { plan } = this.#test;
332 const map = lazyAssertObject(this.#test.root.harness);
333 const assert = { __proto__: null };
334
335 this.#assert = assert;
336 map.forEach((method, name) => {
337 assert[name] = (...args) => {
338 if (plan !== null) {
339 plan.count();
340 }
341 return ReflectApply(method, this, args);
342 };
343 });
344
345 if (!map.has('ok')) {
346 // This is a hack. It allows the innerOk function to collect the
347 // stacktrace from the correct starting point.
348 function ok(...args) {
349 if (plan !== null) {
350 plan.count();
351 }
352 innerOk(ok, ...args);
353 }
354
355 assert.ok = ok;
356 }
357 }
358 return this.#assert;
359 }
360
361 get mock() {
362 this.#test.mock ??= new MockTracker();

Callers 15

mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
test-console.jsFile · 0.80
zipToMapFunction · 0.80
firstFunction · 0.80
lastFunction · 0.80
getSpellingSuggestionFunction · 0.80
matchedTextFunction · 0.80
VersionFunction · 0.80

Calls 4

lazyAssertObjectFunction · 0.85
forEachMethod · 0.65
hasMethod · 0.65
countMethod · 0.45

Tested by

no test coverage detected