| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 97b2c53 commit 05db979
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 | |
|---|---|---|---|
@@ -538,6 +538,7 @@ function run(options = kEmptyObject) { | |||
| 538 | 538 | } | |
| 539 | 539 | const runFiles = () => { | |
| 540 | 540 | root.harness.bootstrapComplete = true; | |
| 541 | + root.harness.allowTestsToRun = true; | ||
| 541 | 542 | return SafePromiseAllSettledReturnVoid(testFiles, (path) => { | |
| 542 | 543 | const subtest = runTestFile(path, filesWatcher, opts); | |
| 543 | 544 | filesWatcher?.runningSubtests.set(path, subtest); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -599,7 +599,7 @@ class Test extends AsyncResource { | |||
| 599 | 599 | // it. Otherwise, return a Promise to the caller and mark the test as | |
| 600 | 600 | // pending for later execution. | |
| 601 | 601 | this.reporter.enqueue(this.nesting, this.loc, this.name); | |
| 602 | - if (!this.parent.hasConcurrency()) { | ||
| 602 | + if (!this.root.harness.allowTestsToRun || !this.parent.hasConcurrency()) { | ||
| 603 | 603 | const deferred = createDeferredPromise(); | |
| 604 | 604 | ||
| 605 | 605 | 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