| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 76eba06 commit 41a775c
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,6 +25,7 @@ const { | |||
| 25 | 25 | setupTestReporters, | |
| 26 | 26 | shouldColorizeTestFiles, | |
| 27 | 27 | } = require('internal/test_runner/utils'); | |
| 28 | + const { queueMicrotask } = require('internal/process/task_queues'); | ||
| 28 | 29 | const { bigint: hrtime } = process.hrtime; | |
| 29 | 30 | ||
| 30 | 31 | const testResources = new SafeMap(); | |
@@ -181,6 +182,7 @@ function setup(root) { | |||
| 181 | 182 | ||
| 182 | 183 | root.harness = { | |
| 183 | 184 | __proto__: null, | |
| 185 | + allowTestsToRun: false, | ||
| 184 | 186 | bootstrapComplete: false, | |
| 185 | 187 | coverage: FunctionPrototypeBind(collectCoverage, null, root, coverage), | |
| 186 | 188 | counters: { | |
@@ -219,7 +221,16 @@ function getGlobalRoot() { | |||
| 219 | 221 | ||
| 220 | 222 | async function startSubtest(subtest) { | |
| 221 | 223 | await reportersSetup; | |
| 222 | - getGlobalRoot().harness.bootstrapComplete = true; | ||
| 224 | + | ||
| 225 | + const root = getGlobalRoot(); | ||
| 226 | + if (!root.harness.bootstrapComplete) { | ||
| 227 | + root.harness.bootstrapComplete = true; | ||
| 228 | + queueMicrotask(() => { | ||
| 229 | + root.harness.allowTestsToRun = true; | ||
| 230 | + root.processPendingSubtests(); | ||
| 231 | + }); | ||
| 232 | + } | ||
| 233 | + | ||
| 223 | 234 | await subtest.start(); | |
| 224 | 235 | } | |
| 225 | 236 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -582,6 +582,7 @@ function run(options) { | |||
| 582 | 582 | } | |
| 583 | 583 | const runFiles = () => { | |
| 584 | 584 | root.harness.bootstrapComplete = true; | |
| 585 | + root.harness.allowTestsToRun = true; | ||
| 585 | 586 | return SafePromiseAllSettledReturnVoid(testFiles, (path) => { | |
| 586 | 587 | const subtest = runTestFile(path, filesWatcher, opts); | |
| 587 | 588 | filesWatcher?.runningSubtests.set(path, subtest); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -571,7 +571,7 @@ class Test extends AsyncResource { | |||
| 571 | 571 | // it. Otherwise, return a Promise to the caller and mark the test as | |
| 572 | 572 | // pending for later execution. | |
| 573 | 573 | this.reporter.enqueue(this.nesting, this.loc, this.name); | |
| 574 | - if (!this.parent.hasConcurrency()) { | ||
| 574 | + if (!this.root.harness.allowTestsToRun || !this.parent.hasConcurrency()) { | ||
| 575 | 575 | const deferred = createDeferredPromise(); | |
| 576 | 576 | ||
| 577 | 577 | deferred.test = this; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,6 +21,9 @@ not ok 1 - fails | |||
| 21 | 21 | * | |
| 22 | 22 | * | |
| 23 | 23 | * | |
| 24 | + * | ||
| 25 | + * | ||
| 26 | + * | ||
| 24 | 27 | ... | |
| 25 | 28 | 1..1 | |
| 26 | 29 | # tests 1 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments