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

Function stopTest

lib/internal/test_runner/test.js:145–171  ·  view source on GitHub ↗
(timeout, signal)

Source from the content-addressed store, hash-verified

143}
144
145function stopTest(timeout, signal) {
146 const deferred = PromiseWithResolvers();
147 const abortListener = addAbortListener(signal, deferred.resolve);
148 let timer;
149 let disposeFunction;
150
151 if (timeout === kDefaultTimeout) {
152 disposeFunction = abortListener[SymbolDispose];
153 } else {
154 timer = setTimeout(deferred.resolve, timeout);
155 timer.unref();
156 setOwnProperty(deferred, 'promise', PromisePrototypeThen(deferred.promise, () => {
157 throw new ERR_TEST_FAILURE(
158 `test timed out after ${timeout}ms`,
159 kTestTimeoutFailure,
160 );
161 }));
162
163 disposeFunction = () => {
164 abortListener[SymbolDispose]();
165 clearTimeout(timer);
166 };
167 }
168
169 setOwnProperty(deferred.promise, SymbolDispose, disposeFunction);
170 return deferred.promise;
171}
172
173function testMatchesPattern(test, patterns) {
174 const matchesByNameOrParent = ArrayPrototypeSome(patterns, (re) =>

Callers 2

runMethod · 0.85
runMethod · 0.85

Calls 5

setOwnPropertyFunction · 0.85
addAbortListenerFunction · 0.50
setTimeoutFunction · 0.50
clearTimeoutFunction · 0.50
unrefMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…