Skip to content

Commit b7bc635

Browse files
cjihrigmarco-ippolito
authored andcommitted
test_runner: ignore todo flag when running suites
This commit removes a check for the todo flag when determining if a suite should run. In general, the todo flag should have no impact on whether or not a test/suite runs. Instead, it should only impact how the result of the test/suite is handled. PR-URL: #52117 Backport-PR-URL: #53093 Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
1 parent f5cd125 commit b7bc635

File tree

3 files changed

+50
-6
lines changed

3 files changed

+50
-6
lines changed

lib/internal/test_runner/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ class Suite extends Test {
952952
constructor(options) {
953953
super(options);
954954

955-
if (testNamePatterns !== null && !options.skip && !options.todo) {
955+
if (testNamePatterns !== null && !options.skip) {
956956
this.fn = options.fn || this.fn;
957957
this.skipped = false;
958958
}

test/fixtures/test-runner/output/name_pattern.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,13 @@ describe('no', function() {
6565
it('yes', () => {});
6666
});
6767
});
68+
69+
describe('no with todo', { todo: true }, () => {
70+
it('no', () => {});
71+
it('yes', () => {});
72+
73+
describe('maybe', function() {
74+
it('no', () => {});
75+
it('yes', () => {});
76+
});
77+
});

test/fixtures/test-runner/output/name_pattern.snapshot

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,46 @@ ok 15 - no
171171
duration_ms: *
172172
type: 'suite'
173173
...
174-
1..15
175-
# tests 21
176-
# suites 10
177-
# pass 13
174+
# Subtest: no with todo
175+
# Subtest: no
176+
ok 1 - no # SKIP test name does not match pattern
177+
---
178+
duration_ms: *
179+
...
180+
# Subtest: yes
181+
ok 2 - yes
182+
---
183+
duration_ms: *
184+
...
185+
# Subtest: maybe
186+
# Subtest: no
187+
ok 1 - no # SKIP test name does not match pattern
188+
---
189+
duration_ms: *
190+
...
191+
# Subtest: yes
192+
ok 2 - yes
193+
---
194+
duration_ms: *
195+
...
196+
1..2
197+
ok 3 - maybe
198+
---
199+
duration_ms: *
200+
type: 'suite'
201+
...
202+
1..3
203+
ok 16 - no with todo # TODO test name does not match pattern
204+
---
205+
duration_ms: *
206+
type: 'suite'
207+
...
208+
1..16
209+
# tests 25
210+
# suites 12
211+
# pass 15
178212
# fail 0
179213
# cancelled 0
180-
# skipped 8
214+
# skipped 10
181215
# todo 0
182216
# duration_ms *

0 commit comments

Comments
 (0)