Skip to content

Commit 4ba9f45

Browse files
authored
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 Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
1 parent 6f4d601 commit 4ba9f45

File tree

3 files changed

+52
-8
lines changed

3 files changed

+52
-8
lines changed

lib/internal/test_runner/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ class Suite extends Test {
984984
constructor(options) {
985985
super(options);
986986

987-
if (testNamePatterns !== null && !options.skip && !options.todo) {
987+
if (testNamePatterns !== null && !options.skip) {
988988
this.fn = options.fn || this.fn;
989989
this.skipped = false;
990990
}

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

+10
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ describe('no', function() {
6666
});
6767
});
6868

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+
});
78+
6979
describe('DescribeForMatchWithAncestors', () => {
7080
it('NestedTest', () => common.mustNotCall());
7181

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

+41-7
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,40 @@ ok 15 - no
171171
duration_ms: *
172172
type: 'suite'
173173
...
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+
...
174208
# Subtest: DescribeForMatchWithAncestors
175209
# Subtest: NestedTest
176210
ok 1 - NestedTest # SKIP test name does not match pattern
@@ -190,7 +224,7 @@ ok 15 - no
190224
type: 'suite'
191225
...
192226
1..2
193-
ok 16 - DescribeForMatchWithAncestors
227+
ok 17 - DescribeForMatchWithAncestors
194228
---
195229
duration_ms: *
196230
type: 'suite'
@@ -202,17 +236,17 @@ ok 16 - DescribeForMatchWithAncestors
202236
duration_ms: *
203237
...
204238
1..1
205-
ok 17 - DescribeForMatchWithAncestors
239+
ok 18 - DescribeForMatchWithAncestors
206240
---
207241
duration_ms: *
208242
type: 'suite'
209243
...
210-
1..17
211-
# tests 24
212-
# suites 13
213-
# pass 14
244+
1..18
245+
# tests 28
246+
# suites 15
247+
# pass 16
214248
# fail 0
215249
# cancelled 0
216-
# skipped 10
250+
# skipped 12
217251
# todo 0
218252
# duration_ms *

0 commit comments

Comments
 (0)