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

Function expectsNoError

lib/assert.js:695–719  ·  view source on GitHub ↗
(stackStartFn, actual, error, message)

Source from the content-addressed store, hash-verified

693}
694
695function expectsNoError(stackStartFn, actual, error, message) {
696 if (actual === NO_EXCEPTION_SENTINEL)
697 return;
698
699 if (typeof error === 'string') {
700 message = error;
701 error = undefined;
702 }
703
704 if (!error || hasMatchingError(actual, error)) {
705 const details = message ? `: ${message}` : '.';
706 const fnType = stackStartFn === Assert.prototype.doesNotReject ?
707 'rejection' : 'exception';
708 innerFail({
709 actual,
710 expected: error,
711 operator: stackStartFn.name,
712 message: [`Got unwanted ${fnType}${details}\n` +
713 `Actual message: "${actual?.message}"`],
714 stackStartFn,
715 diff: this?.[kOptions]?.diff,
716 });
717 }
718 throw actual;
719}
720
721/**
722 * Expects the function `promiseFn` to throw an error.

Callers 1

assert.jsFile · 0.85

Calls 2

hasMatchingErrorFunction · 0.85
innerFailFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…