| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 86bdca9 commit dbaef33
11 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,8 +38,8 @@ function createTestTree(rootTestOptions, globalOptions) { | |||
| 38 | 38 | const buildPhaseDeferred = createDeferredPromise(); | |
| 39 | 39 | const isFilteringByName = globalOptions.testNamePatterns || | |
| 40 | 40 | globalOptions.testSkipPatterns; | |
| 41 | - const isFilteringByOnly = globalOptions.only || (globalOptions.isTestRunner && | ||
| 42 | - globalOptions.isolation === 'none'); | ||
| 41 | + const isFilteringByOnly = (globalOptions.isolation === 'process' || process.env.NODE_TEST_CONTEXT) ? | ||
| 42 | + globalOptions.only : true; | ||
| 43 | 43 | const harness = { | |
| 44 | 44 | __proto__: null, | |
| 45 | 45 | buildPromise: buildPhaseDeferred.promise, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | ..XX...X..XXX.X..... | |
| 2 | 2 | XXX.....X..X...X.... | |
| 3 | 3 | .....X...XXX.XX..... | |
| 4 | - .XXXXXXX...XXXXX | ||
| 4 | + XXXXXXX...XXXXX | ||
| 5 | 5 | ||
| 6 | 6 | Failed tests: | |
| 7 | 7 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -309,15 +309,11 @@ Error [ERR_TEST_FAILURE]: thrown from callback async throw | |||
| 309 | 309 | </failure> | |
| 310 | 310 | </testcase> | |
| 311 | 311 | <testcase name="callback async throw after done" time="*" classname="test"/> | |
| 312 | - <testsuite name="only is set but not in only mode" time="*" disabled="0" errors="0" tests="4" failures="0" skipped="0" hostname="HOSTNAME"> | ||
| 312 | + <testsuite name="only is set on subtests but not in only mode" time="*" disabled="0" errors="0" tests="3" failures="0" skipped="0" hostname="HOSTNAME"> | ||
| 313 | 313 | <testcase name="running subtest 1" time="*" classname="test"/> | |
| 314 | - <testcase name="running subtest 2" time="*" classname="test"/> | ||
| 315 | - <!-- 'only' and 'runOnly' require the --test-only command-line option. --> | ||
| 316 | 314 | <testcase name="running subtest 3" time="*" classname="test"/> | |
| 317 | - <!-- 'only' and 'runOnly' require the --test-only command-line option. --> | ||
| 318 | 315 | <testcase name="running subtest 4" time="*" classname="test"/> | |
| 319 | 316 | </testsuite> | |
| 320 | - <!-- 'only' and 'runOnly' require the --test-only command-line option. --> | ||
| 321 | 317 | <testcase name="custom inspect symbol fail" time="*" classname="test" failure="customized"> | |
| 322 | 318 | <failure type="testCodeFailure" message="customized"> | |
| 323 | 319 | [Error [ERR_TEST_FAILURE]: customized] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: customized } | |
@@ -521,9 +517,9 @@ Error [ERR_TEST_FAILURE]: test could not be started because its parent finished | |||
| 521 | 517 | <!-- Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/output.js:86:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. --> | |
| 522 | 518 | <!-- Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:251:1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. --> | |
| 523 | 519 | <!-- 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. --> | |
| 524 | - <!-- tests 76 --> | ||
| 520 | + <!-- tests 75 --> | ||
| 525 | 521 | <!-- suites 0 --> | |
| 526 | - <!-- pass 35 --> | ||
| 522 | + <!-- pass 34 --> | ||
| 527 | 523 | <!-- fail 25 --> | |
| 528 | 524 | <!-- cancelled 3 --> | |
| 529 | 525 | <!-- skipped 9 --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -274,7 +274,7 @@ test('callback async throw after done', (t, done) => { | |||
| 274 | 274 | done(); | |
| 275 | 275 | }); | |
| 276 | 276 | ||
| 277 | - test('only is set but not in only mode', { only: true }, async (t) => { | ||
| 277 | + test('only is set on subtests but not in only mode', async (t) => { | ||
| 278 | 278 | // All of these subtests should run. | |
| 279 | 279 | await t.test('running subtest 1'); | |
| 280 | 280 | t.runOnly(true); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -463,35 +463,27 @@ ok 48 - callback async throw after done | |||
| 463 | 463 | --- | |
| 464 | 464 | duration_ms: * | |
| 465 | 465 | ... | |
| 466 | - # Subtest: only is set but not in only mode | ||
| 466 | + # Subtest: only is set on subtests but not in only mode | ||
| 467 | 467 | # Subtest: running subtest 1 | |
| 468 | 468 | ok 1 - running subtest 1 | |
| 469 | 469 | --- | |
| 470 | 470 | duration_ms: * | |
| 471 | 471 | ... | |
| 472 | - # Subtest: running subtest 2 | ||
| 473 | - ok 2 - running subtest 2 | ||
| 474 | - --- | ||
| 475 | - duration_ms: * | ||
| 476 | - ... | ||
| 477 | - # 'only' and 'runOnly' require the --test-only command-line option. | ||
| 478 | 472 | # Subtest: running subtest 3 | |
| 479 | - ok 3 - running subtest 3 | ||
| 473 | + ok 2 - running subtest 3 | ||
| 480 | 474 | --- | |
| 481 | 475 | duration_ms: * | |
| 482 | 476 | ... | |
| 483 | - # 'only' and 'runOnly' require the --test-only command-line option. | ||
| 484 | 477 | # Subtest: running subtest 4 | |
| 485 | - ok 4 - running subtest 4 | ||
| 478 | + ok 3 - running subtest 4 | ||
| 486 | 479 | --- | |
| 487 | 480 | duration_ms: * | |
| 488 | 481 | ... | |
| 489 | - 1..4 | ||
| 490 | - ok 49 - only is set but not in only mode | ||
| 482 | + 1..3 | ||
| 483 | + ok 49 - only is set on subtests but not in only mode | ||
| 491 | 484 | --- | |
| 492 | 485 | duration_ms: * | |
| 493 | 486 | ... | |
| 494 | - # 'only' and 'runOnly' require the --test-only command-line option. | ||
| 495 | 487 | # Subtest: custom inspect symbol fail | |
| 496 | 488 | not ok 50 - custom inspect symbol fail | |
| 497 | 489 | --- | |
@@ -718,9 +710,9 @@ not ok 62 - invalid subtest fail | |||
| 718 | 710 | # Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. | |
| 719 | 711 | # Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:(LINE):1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. | |
| 720 | 712 | # 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. | |
| 721 | - # tests 76 | ||
| 713 | + # tests 75 | ||
| 722 | 714 | # suites 0 | |
| 723 | - # pass 35 | ||
| 715 | + # pass 34 | ||
| 724 | 716 | # fail 25 | |
| 725 | 717 | # cancelled 3 | |
| 726 | 718 | # skipped 9 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -463,7 +463,7 @@ ok 48 - callback async throw after done | |||
| 463 | 463 | --- | |
| 464 | 464 | duration_ms: * | |
| 465 | 465 | ... | |
| 466 | - # Subtest: only is set but not in only mode | ||
| 466 | + # Subtest: only is set on subtests but not in only mode | ||
| 467 | 467 | # Subtest: running subtest 1 | |
| 468 | 468 | ok 1 - running subtest 1 | |
| 469 | 469 | --- | |
@@ -487,11 +487,10 @@ ok 48 - callback async throw after done | |||
| 487 | 487 | duration_ms: * | |
| 488 | 488 | ... | |
| 489 | 489 | 1..4 | |
| 490 | - ok 49 - only is set but not in only mode | ||
| 490 | + ok 49 - only is set on subtests but not in only mode | ||
| 491 | 491 | --- | |
| 492 | 492 | duration_ms: * | |
| 493 | 493 | ... | |
| 494 | - # 'only' and 'runOnly' require the --test-only command-line option. | ||
| 495 | 494 | # Subtest: custom inspect symbol fail | |
| 496 | 495 | not ok 50 - custom inspect symbol fail | |
| 497 | 496 | --- | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -185,15 +185,11 @@ | |||
| 185 | 185 | * | |
| 186 | 186 | ||
| 187 | 187 | callback async throw after done (*ms) | |
| 188 | - only is set but not in only mode | ||
| 188 | + only is set on subtests but not in only mode | ||
| 189 | 189 | running subtest 1 (*ms) | |
| 190 | - running subtest 2 (*ms) | ||
| 191 | - 'only' and 'runOnly' require the --test-only command-line option. | ||
| 192 | 190 | running subtest 3 (*ms) | |
| 193 | - 'only' and 'runOnly' require the --test-only command-line option. | ||
| 194 | 191 | running subtest 4 (*ms) | |
| 195 | - only is set but not in only mode (*ms) | ||
| 196 | - 'only' and 'runOnly' require the --test-only command-line option. | ||
| 192 | + only is set on subtests but not in only mode (*ms) | ||
| 197 | 193 | custom inspect symbol fail (*ms) | |
| 198 | 194 | customized | |
| 199 | 195 | ||
@@ -304,9 +300,9 @@ | |||
| 304 | 300 | Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/output.js:86:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event. | |
| 305 | 301 | Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:251:1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event. | |
| 306 | 302 | 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. | |
| 307 | - tests 76 | ||
| 303 | + tests 75 | ||
| 308 | 304 | suites 0 | |
| 309 | - pass 35 | ||
| 305 | + pass 34 | ||
| 310 | 306 | fail 25 | |
| 311 | 307 | cancelled 3 | |
| 312 | 308 | skipped 9 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -185,15 +185,14 @@ | |||
| 185 | 185 | * | |
| 186 | 186 | ||
| 187 | 187 | callback async throw after done (*ms) | |
| 188 | - only is set but not in only mode | ||
| 188 | + only is set on subtests but not in only mode | ||
| 189 | 189 | running subtest 1 (*ms) | |
| 190 | 190 | running subtest 2 (*ms) | |
| 191 | 191 | 'only' and 'runOnly' require the --test-only command-line option. | |
| 192 | 192 | running subtest 3 (*ms) | |
| 193 | 193 | 'only' and 'runOnly' require the --test-only command-line option. | |
| 194 | 194 | running subtest 4 (*ms) | |
| 195 | - only is set but not in only mode (*ms) | ||
| 196 | - 'only' and 'runOnly' require the --test-only command-line option. | ||
| 195 | + only is set on subtests but not in only mode (*ms) | ||
| 197 | 196 | custom inspect symbol fail (*ms) | |
| 198 | 197 | customized | |
| 199 | 198 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,6 +31,28 @@ test('works with --test-only', () => { | |||
| 31 | 31 | assert.match(stdout, /ok 1 - suite two - test/); | |
| 32 | 32 | }); | |
| 33 | 33 | ||
| 34 | + test('works without --test-only', () => { | ||
| 35 | + const args = [ | ||
| 36 | + '--test', | ||
| 37 | + '--test-reporter=tap', | ||
| 38 | + '--experimental-test-isolation=none', | ||
| 39 | + fixture1, | ||
| 40 | + fixture2, | ||
| 41 | + ]; | ||
| 42 | + const child = spawnSync(process.execPath, args); | ||
| 43 | + const stdout = child.stdout.toString(); | ||
| 44 | + | ||
| 45 | + assert.strictEqual(child.status, 0); | ||
| 46 | + assert.strictEqual(child.signal, null); | ||
| 47 | + assert.match(stdout, /# tests 2/); | ||
| 48 | + assert.match(stdout, /# suites 2/); | ||
| 49 | + assert.match(stdout, /# pass 2/); | ||
| 50 | + assert.match(stdout, /ok 1 - suite one/); | ||
| 51 | + assert.match(stdout, /ok 1 - suite one - test/); | ||
| 52 | + assert.match(stdout, /ok 2 - suite two/); | ||
| 53 | + assert.match(stdout, /ok 1 - suite two - test/); | ||
| 54 | + }); | ||
| 55 | + | ||
| 34 | 56 | test('works with --test-name-pattern', () => { | |
| 35 | 57 | const args = [ | |
| 36 | 58 | '--test', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,7 @@ const stream = run({ | |||
| 12 | 12 | }); | |
| 13 | 13 | ||
| 14 | 14 | stream.on('test:fail', mustNotCall()); | |
| 15 | - stream.on('test:pass', mustCall(5)); | ||
| 15 | + stream.on('test:pass', mustCall(4)); | ||
| 16 | 16 | // eslint-disable-next-line no-unused-vars | |
| 17 | 17 | for await (const _ of stream); | |
| 18 | 18 | allowGlobals(globalThis.GLOBAL_ORDER); | |
@@ -28,12 +28,6 @@ deepStrictEqual(globalThis.GLOBAL_ORDER, [ | |||
| 28 | 28 | 'afterEach one: suite one - test', | |
| 29 | 29 | 'afterEach two: suite one - test', | |
| 30 | 30 | ||
| 31 | - 'beforeEach one: test one', | ||
| 32 | - 'beforeEach two: test one', | ||
| 33 | - 'test one', | ||
| 34 | - 'afterEach one: test one', | ||
| 35 | - 'afterEach two: test one', | ||
| 36 | - | ||
| 37 | 31 | 'before suite two: suite two', | |
| 38 | 32 | ||
| 39 | 33 | 'beforeEach one: suite two - test', | |
| Back | FazBrowse Home | New Git URL |
0 commit comments