GeezerVison is showing github.com — test_runner: detect only tests when isolation is off · nodejs/node@3396a49
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: doc/api/cli.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2334,7 +2334,7 @@ changes: | 2334 | 2334 | --> | 2335 | 2335 |
| 2336 | 2336 | Configures the test runner to only execute top level tests that have the `only` | 2337 | | -option set. | | 2337 | +option set. This flag is not necessary when test isolation is disabled. | 2338 | 2338 |
| 2339 | 2339 | ### `--test-reporter` | 2340 | 2340 |
| |
Collapse file Copy file name to clipboardExpand all lines: doc/api/test.md +4-4Lines changed: 4 additions & 4 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -229,10 +229,10 @@ const { describe, it } = require('node:test'); | 229 | 229 |
| 230 | 230 | ## `only` tests | 231 | 231 |
| 232 | | -If Node.js is started with the [`--test-only`][] command-line option, it is | 233 | | -possible to skip all tests except for a selected subset by passing | 234 | | -the `only` option to the tests that should run. When a test with the `only` | 235 | | -option is set, all subtests are also run. | | 232 | +If Node.js is started with the [`--test-only`][] command-line option, or test | | 233 | +isolation is disabled, it is possible to skip all tests except for a selected | | 234 | +subset by passing the `only` option to the tests that should run. When a test | | 235 | +with the `only` option is set, all subtests are also run. | 236 | 236 | If a suite has the `only` option set, all tests within the suite are run, | 237 | 237 | unless it has descendants with the `only` option set, in which case only those | 238 | 238 | tests are run. | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/test_runner/harness.js +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -38,7 +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; | | 41 | + const isFilteringByOnly = globalOptions.only || (globalOptions.isTestRunner && | | 42 | + globalOptions.isolation === 'none'); | 42 | 43 | const harness = { | 43 | 44 | __proto__: null, | 44 | 45 | buildPromise: buildPhaseDeferred.promise, | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-runner-no-isolation-filtering.js +1-3Lines changed: 1 addition & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -45,10 +45,8 @@ test('works with --test-name-pattern', () => { | 45 | 45 |
| 46 | 46 | assert.strictEqual(child.status, 0); | 47 | 47 | assert.strictEqual(child.signal, null); | 48 | | - assert.match(stdout, /# tests 1/); | | 48 | + assert.match(stdout, /# tests 0/); | 49 | 49 | assert.match(stdout, /# suites 0/); | 50 | | - assert.match(stdout, /# pass 1/); | 51 | | - assert.match(stdout, /ok 1 - test one/); | 52 | 50 | }); | 53 | 51 |
| 54 | 52 | test('works with --test-skip-pattern', () => { | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-runner-no-isolation-hooks.mjs -9Lines changed: 0 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,15 +31,6 @@ const order = [ | 31 | 31 | 'afterEach one: suite one - test', | 32 | 32 | 'afterEach two: suite one - test', | 33 | 33 |
| 34 | | - 'beforeEach(): global', | 35 | | - 'beforeEach one: test one', | 36 | | - 'beforeEach two: test one', | 37 | | - 'test one', | 38 | | - | 39 | | - 'afterEach(): global', | 40 | | - 'afterEach one: test one', | 41 | | - 'afterEach two: test one', | 42 | | - | 43 | 34 | 'before suite two: suite two', | 44 | 35 | 'beforeEach(): global', | 45 | 36 | 'beforeEach one: suite two - test', | |
|