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

Function cb

lib/internal/test_runner/utils.js:81–102  ·  view source on GitHub ↗
(err)

Source from the content-addressed store, hash-verified

79 let calledCount = 0;
80 const { promise, resolve, reject } = PromiseWithResolvers();
81 const cb = (err) => {
82 calledCount++;
83
84 // If the callback is called a second time, let the user know, but
85 // don't let them know more than once.
86 if (calledCount > 1) {
87 if (calledCount === 2) {
88 throw new ERR_TEST_FAILURE(
89 'callback invoked multiple times',
90 kMultipleCallbackInvocations,
91 );
92 }
93
94 return;
95 }
96
97 if (err) {
98 return reject(err);
99 }
100
101 resolve();
102 };
103
104 return { __proto__: null, promise, cb };
105}

Callers 15

callbackifyOnRejectedFunction · 0.50
net.jsFile · 0.50
onCloseFunction · 0.50
InterfaceFunction · 0.50
defaultEvalMethod · 0.50
finishExecutionMethod · 0.50
onErrorFunction · 0.50
_http_agent.jsFile · 0.50
makeStatsCallbackFunction · 0.50
createConnectionFunction · 0.50
makeSyncWriteFunction · 0.50
doCloseMethod · 0.50

Calls 2

rejectFunction · 0.50
resolveFunction · 0.50

Tested by

no test coverage detected