| 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) { |