diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 64205bd673a778..e2576f30b19fab 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -984,7 +984,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; } diff --git a/test/fixtures/test-runner/output/name_pattern.js b/test/fixtures/test-runner/output/name_pattern.js index 0057d8572de958..c3eff693f1b356 100644 --- a/test/fixtures/test-runner/output/name_pattern.js +++ b/test/fixtures/test-runner/output/name_pattern.js @@ -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()); diff --git a/test/fixtures/test-runner/output/name_pattern.snapshot b/test/fixtures/test-runner/output/name_pattern.snapshot index 0326f01d29adc6..b4dab2a4653dee 100644 --- a/test/fixtures/test-runner/output/name_pattern.snapshot +++ b/test/fixtures/test-runner/output/name_pattern.snapshot @@ -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 @@ -190,7 +224,7 @@ ok 15 - no type: 'suite' ... 1..2 -ok 16 - DescribeForMatchWithAncestors +ok 17 - DescribeForMatchWithAncestors --- duration_ms: * type: 'suite' @@ -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 *