Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_runner: ignore todo flag when running suites #52117

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ class Suite extends Test {
constructor(options) {
super(options);

if (testNamePatterns !== null && !options.skip && !options.todo) {
if (testNamePatterns !== null && !options.skip) {
this.fn = options.fn || this.fn;
this.skipped = false;
}
Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/test-runner/output/name_pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ describe('no', function() {
});
});

describe('no with todo', { todo: true }, () => {
it('no', () => {});
it('yes', () => {});

describe('maybe', function() {
it('no', () => {});
it('yes', () => {});
});
});

describe('DescribeForMatchWithAncestors', () => {
it('NestedTest', () => common.mustNotCall());

Expand Down
48 changes: 41 additions & 7 deletions test/fixtures/test-runner/output/name_pattern.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,40 @@ ok 15 - no
duration_ms: *
type: 'suite'
...
# Subtest: no with todo
# Subtest: no
ok 1 - no # SKIP test name does not match pattern
---
duration_ms: *
...
# Subtest: yes
ok 2 - yes
---
duration_ms: *
...
# Subtest: maybe
# Subtest: no
ok 1 - no # SKIP test name does not match pattern
---
duration_ms: *
...
# Subtest: yes
ok 2 - yes
---
duration_ms: *
...
1..2
ok 3 - maybe
---
duration_ms: *
type: 'suite'
...
1..3
ok 16 - no with todo # TODO test name does not match pattern
---
duration_ms: *
type: 'suite'
...
# Subtest: DescribeForMatchWithAncestors
# Subtest: NestedTest
ok 1 - NestedTest # SKIP test name does not match pattern
Expand All @@ -190,7 +224,7 @@ ok 15 - no
type: 'suite'
...
1..2
ok 16 - DescribeForMatchWithAncestors
ok 17 - DescribeForMatchWithAncestors
---
duration_ms: *
type: 'suite'
Expand All @@ -202,17 +236,17 @@ ok 16 - DescribeForMatchWithAncestors
duration_ms: *
...
1..1
ok 17 - DescribeForMatchWithAncestors
ok 18 - DescribeForMatchWithAncestors
---
duration_ms: *
type: 'suite'
...
1..17
# tests 24
# suites 13
# pass 14
1..18
# tests 28
# suites 15
# pass 16
# fail 0
# cancelled 0
# skipped 10
# skipped 12
# todo 0
# duration_ms *
Loading