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

Method start

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

Source from the content-addressed store, hash-verified

1199 }
1200
1201 start() {
1202 this.applyFilters();
1203
1204 if (this.filtered) {
1205 noopTestStream ??= new TestsStream();
1206 this.reporter = noopTestStream;
1207 this.run = this.filteredRun;
1208 } else {
1209 this.testNumber = ++this.parent.outputSubtestCount;
1210 }
1211
1212 // If there is enough available concurrency to run the test now, then do
1213 // it. Otherwise, return a Promise to the caller and mark the test as
1214 // pending for later execution.
1215 this.parent.unfinishedSubtests.add(this);
1216 this.reporter.enqueue(this.nesting, this.loc, this.name, this.reportedType,
1217 this.testId, this.parent?.testId, this.tags);
1218 if (this.root.harness.buildPromise || !this.parent.hasConcurrency()) {
1219 const deferred = PromiseWithResolvers();
1220
1221 setOwnProperty(deferred, 'test', this);
1222 this.parent.addPendingSubtest(deferred);
1223 return deferred.promise;
1224 }
1225
1226 // When this parent dequeues subtests through subtestQueueRandom, defer the
1227 // first start to the next microtask so siblings created in the same
1228 // synchronous turn are all eligible for the first randomized pick, rather
1229 // than letting declaration order claim the initial concurrency slot(s).
1230 if (this.parent.subtestQueueRandom) {
1231 const deferred = PromiseWithResolvers();
1232
1233 setOwnProperty(deferred, 'test', this);
1234 this.parent.addPendingSubtest(deferred);
1235 this.parent.schedulePendingSubtests();
1236 return deferred.promise;
1237 }
1238
1239 this.parent.assignReportOrder(this);
1240 this.reporter.dequeue(this.nesting, this.loc, this.name, this.reportedType,
1241 this.testId, this.parent?.testId, this.tags);
1242 return this.run();
1243 }
1244
1245 [kShouldAbort]() {
1246 if (this.signal.aborted || this.outerSignal?.aborted) {

Callers 15

createReplFunction · 0.45
constructorMethod · 0.45
profileFunction · 0.45
createReplFunction · 0.45
runTestFileFunction · 0.45
testMethod · 0.45
constructorMethod · 0.45
reportStartedMethod · 0.45
runMethod · 0.45
worker_thread.jsFile · 0.45
inspect.jsFile · 0.45

Calls 10

applyFiltersMethod · 0.95
runMethod · 0.95
setOwnPropertyFunction · 0.85
hasConcurrencyMethod · 0.80
addPendingSubtestMethod · 0.80
assignReportOrderMethod · 0.80
dequeueMethod · 0.80
addMethod · 0.65
enqueueMethod · 0.45

Tested by 1

testMethod · 0.36