| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d0e42ff commit 6ef7329
11 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,8 +28,6 @@ const { | |||
| 28 | 28 | setupGlobalSetupTeardownFunctions, | |
| 29 | 29 | } = require('internal/test_runner/utils'); | |
| 30 | 30 | const { queueMicrotask } = require('internal/process/task_queues'); | |
| 31 | - const { TIMEOUT_MAX } = require('internal/timers'); | ||
| 32 | - const { clearInterval, setInterval } = require('timers'); | ||
| 33 | 31 | const { bigint: hrtime } = process.hrtime; | |
| 34 | 32 | const testResources = new SafeMap(); | |
| 35 | 33 | let globalRoot; | |
@@ -230,20 +228,11 @@ function setupProcessState(root, globalOptions) { | |||
| 230 | 228 | const rejectionHandler = | |
| 231 | 229 | createProcessEventHandler('unhandledRejection', root); | |
| 232 | 230 | const coverage = configureCoverage(root, globalOptions); | |
| 233 | - const exitHandler = async (kill) => { | ||
| 231 | + const exitHandler = async () => { | ||
| 234 | 232 | if (root.subtests.length === 0 && (root.hooks.before.length > 0 || root.hooks.after.length > 0)) { | |
| 235 | 233 | // Run global before/after hooks in case there are no tests | |
| 236 | 234 | await root.run(); | |
| 237 | 235 | } | |
| 238 | - | ||
| 239 | - if (kill !== true && root.subtestsPromise !== null) { | ||
| 240 | - // Wait for all subtests to finish, but keep the process alive in case | ||
| 241 | - // there are no ref'ed handles left. | ||
| 242 | - const keepAlive = setInterval(() => {}, TIMEOUT_MAX); | ||
| 243 | - await root.subtestsPromise.promise; | ||
| 244 | - clearInterval(keepAlive); | ||
| 245 | - } | ||
| 246 | - | ||
| 247 | 236 | root.postRun(new ERR_TEST_FAILURE( | |
| 248 | 237 | 'Promise resolution is still pending but the event loop has already resolved', | |
| 249 | 238 | kCancelledByParent)); | |
@@ -263,8 +252,8 @@ function setupProcessState(root, globalOptions) { | |||
| 263 | 252 | } | |
| 264 | 253 | }; | |
| 265 | 254 | ||
| 266 | - const terminationHandler = async () => { | ||
| 267 | - await exitHandler(true); | ||
| 255 | + const terminationHandler = () => { | ||
| 256 | + exitHandler(); | ||
| 268 | 257 | process.exit(); | |
| 269 | 258 | }; | |
| 270 | 259 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -651,8 +651,6 @@ class Test extends AsyncResource { | |||
| 651 | 651 | this.activeSubtests = 0; | |
| 652 | 652 | this.pendingSubtests = []; | |
| 653 | 653 | this.readySubtests = new SafeMap(); | |
| 654 | - this.unfinishedSubtests = new SafeSet(); | ||
| 655 | - this.subtestsPromise = null; | ||
| 656 | 654 | this.subtests = []; | |
| 657 | 655 | this.waitingOn = 0; | |
| 658 | 656 | this.finished = false; | |
@@ -756,11 +754,6 @@ class Test extends AsyncResource { | |||
| 756 | 754 | ||
| 757 | 755 | addReadySubtest(subtest) { | |
| 758 | 756 | this.readySubtests.set(subtest.childNumber, subtest); | |
| 759 | - | ||
| 760 | - if (this.unfinishedSubtests.delete(subtest) && | ||
| 761 | - this.unfinishedSubtests.size === 0) { | ||
| 762 | - this.subtestsPromise.resolve(); | ||
| 763 | - } | ||
| 764 | 757 | } | |
| 765 | 758 | ||
| 766 | 759 | processReadySubtestRange(canSend) { | |
@@ -822,7 +815,6 @@ class Test extends AsyncResource { | |||
| 822 | 815 | ||
| 823 | 816 | if (parent.waitingOn === 0) { | |
| 824 | 817 | parent.waitingOn = test.childNumber; | |
| 825 | - parent.subtestsPromise = PromiseWithResolvers(); | ||
| 826 | 818 | } | |
| 827 | 819 | ||
| 828 | 820 | if (preventAddingSubtests) { | |
@@ -945,7 +937,6 @@ class Test extends AsyncResource { | |||
| 945 | 937 | // If there is enough available concurrency to run the test now, then do | |
| 946 | 938 | // it. Otherwise, return a Promise to the caller and mark the test as | |
| 947 | 939 | // pending for later execution. | |
| 948 | - this.parent.unfinishedSubtests.add(this); | ||
| 949 | 940 | this.reporter.enqueue(this.nesting, this.loc, this.name, this.reportedType); | |
| 950 | 941 | if (this.root.harness.buildPromise || !this.parent.hasConcurrency()) { | |
| 951 | 942 | const deferred = PromiseWithResolvers(); | |
@@ -1070,10 +1061,6 @@ class Test extends AsyncResource { | |||
| 1070 | 1061 | ||
| 1071 | 1062 | this[kShouldAbort](); | |
| 1072 | 1063 | ||
| 1073 | - if (this.subtestsPromise !== null) { | ||
| 1074 | - await SafePromiseRace([this.subtestsPromise.promise, stopPromise]); | ||
| 1075 | - } | ||
| 1076 | - | ||
| 1077 | 1064 | if (this.plan !== null) { | |
| 1078 | 1065 | const planPromise = this.plan?.check(); | |
| 1079 | 1066 | // If the plan returns a promise, it means that it is waiting for more assertions to be made before | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,13 +3,13 @@ | |||
| 3 | 3 | [90m﹣ should skip [90m(*ms)[39m # SKIP[39m | |
| 4 | 4 | ▶ parent | |
| 5 | 5 | [31m✖ should fail [90m(*ms)[39m[39m | |
| 6 | - [32m✔ should pass but parent fail [90m(*ms)[39m[39m | ||
| 6 | + [31m✖ should pass but parent fail [90m(*ms)[39m[39m | ||
| 7 | 7 | [31m✖ parent [90m(*ms)[39m[39m | |
| 8 | 8 | [34mℹ tests 6[39m | |
| 9 | 9 | [34mℹ suites 0[39m | |
| 10 | - [34mℹ pass 2[39m | ||
| 10 | + [34mℹ pass 1[39m | ||
| 11 | 11 | [34mℹ fail 3[39m | |
| 12 | - [34mℹ cancelled 0[39m | ||
| 12 | + [34mℹ cancelled 1[39m | ||
| 13 | 13 | [34mℹ skipped 1[39m | |
| 14 | 14 | [34mℹ todo 0[39m | |
| 15 | 15 | [34mℹ duration_ms *[39m | |
@@ -40,3 +40,7 @@ | |||
| 40 | 40 | *[39m | |
| 41 | 41 | *[39m | |
| 42 | 42 | *[39m | |
| 43 | + | ||
| 44 | + * | ||
| 45 | + [31m✖ should pass but parent fail [90m(*ms)[39m[39m | ||
| 46 | + [32m'test did not finish before its parent and was cancelled'[39m | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | ..XX...X..XXX.X..... | |
| 2 | - XXX............X.... | ||
| 2 | + XXX.....X..X...X.... | ||
| 3 | 3 | .....X...XXX.XX..... | |
| 4 | 4 | XXXXXXX...XXXXX | |
| 5 | 5 | ||
@@ -93,6 +93,10 @@ Failed tests: | |||
| 93 | 93 | '1 subtest failed' | |
| 94 | 94 | ✖ sync throw non-error fail (*ms) | |
| 95 | 95 | Symbol(thrown symbol from sync throw non-error fail) | |
| 96 | + ✖ +long running (*ms) | ||
| 97 | + 'test did not finish before its parent and was cancelled' | ||
| 98 | + ✖ top level (*ms) | ||
| 99 | + '1 subtest failed' | ||
| 96 | 100 | ✖ sync skip option is false fail (*ms) | |
| 97 | 101 | Error: this should be executed | |
| 98 | 102 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -186,8 +186,12 @@ Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fail | |||
| 186 | 186 | <testcase name="level 1c" time="*" classname="test"/> | |
| 187 | 187 | <testcase name="level 1d" time="*" classname="test"/> | |
| 188 | 188 | </testsuite> | |
| 189 | - <testsuite name="top level" time="*" disabled="0" errors="0" tests="2" failures="0" skipped="0" hostname="HOSTNAME"> | ||
| 190 | - <testcase name="+long running" time="*" classname="test"/> | ||
| 189 | + <testsuite name="top level" time="*" disabled="0" errors="0" tests="2" failures="1" skipped="0" hostname="HOSTNAME"> | ||
| 190 | + <testcase name="+long running" time="*" classname="test" failure="test did not finish before its parent and was cancelled"> | ||
| 191 | + <failure type="cancelledByParent" message="test did not finish before its parent and was cancelled"> | ||
| 192 | + [Error [ERR_TEST_FAILURE]: test did not finish before its parent and was cancelled] { code: 'ERR_TEST_FAILURE', failureType: 'cancelledByParent', cause: 'test did not finish before its parent and was cancelled' } | ||
| 193 | + </failure> | ||
| 194 | + </testcase> | ||
| 191 | 195 | <testsuite name="+short running" time="*" disabled="0" errors="0" tests="1" failures="0" skipped="0" hostname="HOSTNAME"> | |
| 192 | 196 | <testcase name="++short running" time="*" classname="test"/> | |
| 193 | 197 | </testsuite> | |
@@ -512,9 +516,9 @@ Error [ERR_TEST_FAILURE]: test could not be started because its parent finished | |||
| 512 | 516 | <!-- Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:269:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. --> | |
| 513 | 517 | <!-- tests 75 --> | |
| 514 | 518 | <!-- suites 0 --> | |
| 515 | - <!-- pass 36 --> | ||
| 516 | - <!-- fail 24 --> | ||
| 517 | - <!-- cancelled 2 --> | ||
| 519 | + <!-- pass 34 --> | ||
| 520 | + <!-- fail 25 --> | ||
| 521 | + <!-- cancelled 3 --> | ||
| 518 | 522 | <!-- skipped 9 --> | |
| 519 | 523 | <!-- todo 4 --> | |
| 520 | 524 | <!-- duration_ms * --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,23 +1,35 @@ | |||
| 1 | 1 | TAP version 13 | |
| 2 | 2 | # Subtest: does not keep event loop alive | |
| 3 | 3 | # Subtest: +does not keep event loop alive | |
| 4 | - ok 1 - +does not keep event loop alive | ||
| 4 | + not ok 1 - +does not keep event loop alive | ||
| 5 | 5 | --- | |
| 6 | 6 | duration_ms: * | |
| 7 | 7 | type: 'test' | |
| 8 | + location: '/test/fixtures/test-runner/output/no_refs.js:(LINE):11' | ||
| 9 | + failureType: 'cancelledByParent' | ||
| 10 | + error: 'Promise resolution is still pending but the event loop has already resolved' | ||
| 11 | + code: 'ERR_TEST_FAILURE' | ||
| 12 | + stack: |- | ||
| 13 | + * | ||
| 8 | 14 | ... | |
| 9 | 15 | 1..1 | |
| 10 | - ok 1 - does not keep event loop alive | ||
| 16 | + not ok 1 - does not keep event loop alive | ||
| 11 | 17 | --- | |
| 12 | 18 | duration_ms: * | |
| 13 | 19 | type: 'test' | |
| 20 | + location: '/test/fixtures/test-runner/output/no_refs.js:(LINE):1' | ||
| 21 | + failureType: 'cancelledByParent' | ||
| 22 | + error: 'Promise resolution is still pending but the event loop has already resolved' | ||
| 23 | + code: 'ERR_TEST_FAILURE' | ||
| 24 | + stack: |- | ||
| 25 | + * | ||
| 14 | 26 | ... | |
| 15 | 27 | 1..1 | |
| 16 | 28 | # tests 2 | |
| 17 | 29 | # suites 0 | |
| 18 | - # pass 2 | ||
| 30 | + # pass 0 | ||
| 19 | 31 | # fail 0 | |
| 20 | - # cancelled 0 | ||
| 32 | + # cancelled 2 | ||
| 21 | 33 | # skipped 0 | |
| 22 | 34 | # todo 0 | |
| 23 | 35 | # duration_ms * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -288,10 +288,14 @@ ok 23 - level 0a | |||
| 288 | 288 | ... | |
| 289 | 289 | # Subtest: top level | |
| 290 | 290 | # Subtest: +long running | |
| 291 | - ok 1 - +long running | ||
| 291 | + not ok 1 - +long running | ||
| 292 | 292 | --- | |
| 293 | 293 | duration_ms: * | |
| 294 | 294 | type: 'test' | |
| 295 | + location: '/test/fixtures/test-runner/output/output.js:(LINE):5' | ||
| 296 | + failureType: 'cancelledByParent' | ||
| 297 | + error: 'test did not finish before its parent and was cancelled' | ||
| 298 | + code: 'ERR_TEST_FAILURE' | ||
| 295 | 299 | ... | |
| 296 | 300 | # Subtest: +short running | |
| 297 | 301 | # Subtest: ++short running | |
@@ -307,10 +311,14 @@ ok 23 - level 0a | |||
| 307 | 311 | type: 'test' | |
| 308 | 312 | ... | |
| 309 | 313 | 1..2 | |
| 310 | - ok 24 - top level | ||
| 314 | + not ok 24 - top level | ||
| 311 | 315 | --- | |
| 312 | 316 | duration_ms: * | |
| 313 | 317 | type: 'test' | |
| 318 | + location: '/test/fixtures/test-runner/output/output.js:(LINE):1' | ||
| 319 | + failureType: 'subtestsFailed' | ||
| 320 | + error: '1 subtest failed' | ||
| 321 | + code: 'ERR_TEST_FAILURE' | ||
| 314 | 322 | ... | |
| 315 | 323 | # Subtest: invalid subtest - pass but subtest fails | |
| 316 | 324 | ok 25 - invalid subtest - pass but subtest fails | |
@@ -777,9 +785,9 @@ not ok 62 - invalid subtest fail | |||
| 777 | 785 | # Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. | |
| 778 | 786 | # tests 75 | |
| 779 | 787 | # suites 0 | |
| 780 | - # pass 36 | ||
| 781 | - # fail 24 | ||
| 782 | - # cancelled 2 | ||
| 788 | + # pass 34 | ||
| 789 | + # fail 25 | ||
| 790 | + # cancelled 3 | ||
| 783 | 791 | # skipped 9 | |
| 784 | 792 | # todo 4 | |
| 785 | 793 | # duration_ms * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -288,10 +288,14 @@ ok 23 - level 0a | |||
| 288 | 288 | ... | |
| 289 | 289 | # Subtest: top level | |
| 290 | 290 | # Subtest: +long running | |
| 291 | - ok 1 - +long running | ||
| 291 | + not ok 1 - +long running | ||
| 292 | 292 | --- | |
| 293 | 293 | duration_ms: * | |
| 294 | 294 | type: 'test' | |
| 295 | + location: '/test/fixtures/test-runner/output/output.js:(LINE):5' | ||
| 296 | + failureType: 'cancelledByParent' | ||
| 297 | + error: 'test did not finish before its parent and was cancelled' | ||
| 298 | + code: 'ERR_TEST_FAILURE' | ||
| 295 | 299 | ... | |
| 296 | 300 | # Subtest: +short running | |
| 297 | 301 | # Subtest: ++short running | |
@@ -307,10 +311,14 @@ ok 23 - level 0a | |||
| 307 | 311 | type: 'test' | |
| 308 | 312 | ... | |
| 309 | 313 | 1..2 | |
| 310 | - ok 24 - top level | ||
| 314 | + not ok 24 - top level | ||
| 311 | 315 | --- | |
| 312 | 316 | duration_ms: * | |
| 313 | 317 | type: 'test' | |
| 318 | + location: '/test/fixtures/test-runner/output/output.js:(LINE):1' | ||
| 319 | + failureType: 'subtestsFailed' | ||
| 320 | + error: '1 subtest failed' | ||
| 321 | + code: 'ERR_TEST_FAILURE' | ||
| 314 | 322 | ... | |
| 315 | 323 | # Subtest: invalid subtest - pass but subtest fails | |
| 316 | 324 | ok 25 - invalid subtest - pass but subtest fails | |
@@ -791,9 +799,9 @@ ok 63 - last test | |||
| 791 | 799 | 1..63 | |
| 792 | 800 | # tests 77 | |
| 793 | 801 | # suites 0 | |
| 794 | - # pass 38 | ||
| 795 | - # fail 24 | ||
| 796 | - # cancelled 2 | ||
| 802 | + # pass 36 | ||
| 803 | + # fail 25 | ||
| 804 | + # cancelled 3 | ||
| 797 | 805 | # skipped 9 | |
| 798 | 806 | # todo 4 | |
| 799 | 807 | # duration_ms * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -90,9 +90,9 @@ | |||
| 90 | 90 | Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:269:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. | |
| 91 | 91 | tests 75 | |
| 92 | 92 | suites 0 | |
| 93 | - pass 36 | ||
| 94 | - fail 24 | ||
| 95 | - cancelled 2 | ||
| 93 | + pass 34 | ||
| 94 | + fail 25 | ||
| 95 | + cancelled 3 | ||
| 96 | 96 | skipped 9 | |
| 97 | 97 | todo 4 | |
| 98 | 98 | duration_ms * | |
@@ -203,6 +203,10 @@ | |||
| 203 | 203 | sync throw non-error fail (*ms) | |
| 204 | 204 | Symbol(thrown symbol from sync throw non-error fail) | |
| 205 | 205 | ||
| 206 | + * | ||
| 207 | + +long running (*ms) | ||
| 208 | + 'test did not finish before its parent and was cancelled' | ||
| 209 | + | ||
| 206 | 210 | * | |
| 207 | 211 | sync skip option is false fail (*ms) | |
| 208 | 212 | Error: this should be executed | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -93,9 +93,9 @@ | |||
| 93 | 93 | Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:269:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. | |
| 94 | 94 | tests 76 | |
| 95 | 95 | suites 0 | |
| 96 | - pass 37 | ||
| 97 | - fail 24 | ||
| 98 | - cancelled 2 | ||
| 96 | + pass 35 | ||
| 97 | + fail 25 | ||
| 98 | + cancelled 3 | ||
| 99 | 99 | skipped 9 | |
| 100 | 100 | todo 4 | |
| 101 | 101 | duration_ms * | |
@@ -206,6 +206,10 @@ | |||
| 206 | 206 | sync throw non-error fail (*ms) | |
| 207 | 207 | Symbol(thrown symbol from sync throw non-error fail) | |
| 208 | 208 | ||
| 209 | + * | ||
| 210 | + +long running (*ms) | ||
| 211 | + 'test did not finish before its parent and was cancelled' | ||
| 212 | + | ||
| 209 | 213 | * | |
| 210 | 214 | sync skip option is false fail (*ms) | |
| 211 | 215 | Error: this should be executed | |
| Back | FazBrowse Home | New Git URL |
0 commit comments