Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2262653

Browse filesBrowse files
committed
test_runner: apply runOnly on suites
PR-URL: #48279 Fixes: #47937 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent 9d4025c commit 2262653
Copy full SHA for 2262653

File tree

Expand file treeCollapse file tree

3 files changed

+14
-12
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+14
-12
lines changed
Open diff view settings
Collapse file

‎lib/internal/test_runner/test.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/test.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,8 @@ class Suite extends Test {
759759
constructor(options) {
760760
super(options);
761761

762+
this.runOnlySubtests = testOnlyFlag;
763+
762764
try {
763765
const { ctx, args } = this.getRunArgs();
764766
const runArgs = [this.fn, ctx];
Collapse file

‎test/fixtures/test-runner/output/only_tests.js‎

Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/only_tests.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ test('only = true, with subtests', { only: true }, async (t) => {
4848
});
4949

5050
describe.only('describe only = true, with subtests', () => {
51-
it('`it` subtest 1 should run', () => {});
51+
it.only('`it` subtest 1 should run', () => {});
5252

53-
it('`it` subtest 2 should run', async () => {});
53+
it('`it` subtest 2 should not run', async () => {});
5454
});
5555

5656
describe.only('describe only = true, with a mixture of subtests', () => {
@@ -92,9 +92,9 @@ describe.only('describe only = true, with a mixture of subtests', () => {
9292
});
9393

9494
describe.only('describe only = true, with subtests', () => {
95-
test('subtest should run', () => {});
95+
test.only('subtest should run', () => {});
9696

97-
test('async subtest should run', async () => {});
97+
test('async subtest should not run', async () => {});
9898

9999
test('subtest should be skipped', { only: false }, () => {});
100100
});
Collapse file

‎test/fixtures/test-runner/output/only_tests.snapshot‎

Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/only_tests.snapshot
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ ok 11 - only = true, with subtests
122122
---
123123
duration_ms: *
124124
...
125-
# Subtest: `it` subtest 2 should run
126-
ok 2 - `it` subtest 2 should run
125+
# Subtest: `it` subtest 2 should not run
126+
ok 2 - `it` subtest 2 should not run # SKIP 'only' option not set
127127
---
128128
duration_ms: *
129129
...
@@ -155,7 +155,7 @@ ok 12 - describe only = true, with subtests
155155
duration_ms: *
156156
...
157157
# Subtest: `it` subtest 3 skip
158-
ok 5 - `it` subtest 3 skip # SKIP
158+
ok 5 - `it` subtest 3 skip # SKIP 'only' option not set
159159
---
160160
duration_ms: *
161161
...
@@ -185,7 +185,7 @@ ok 12 - describe only = true, with subtests
185185
duration_ms: *
186186
...
187187
# Subtest: `test` subtest 3 skip
188-
ok 11 - `test` subtest 3 skip # SKIP
188+
ok 11 - `test` subtest 3 skip # SKIP 'only' option not set
189189
---
190190
duration_ms: *
191191
...
@@ -206,8 +206,8 @@ ok 13 - describe only = true, with a mixture of subtests
206206
---
207207
duration_ms: *
208208
...
209-
# Subtest: async subtest should run
210-
ok 2 - async subtest should run
209+
# Subtest: async subtest should not run
210+
ok 2 - async subtest should not run # SKIP 'only' option not set
211211
---
212212
duration_ms: *
213213
...
@@ -225,9 +225,9 @@ ok 14 - describe only = true, with subtests
225225
1..14
226226
# tests 40
227227
# suites 3
228-
# pass 17
228+
# pass 15
229229
# fail 0
230230
# cancelled 0
231-
# skipped 23
231+
# skipped 25
232232
# todo 0
233233
# duration_ms *

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.