-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_runner: allow subtest filtering via --test-name-pattern
- Loading branch information
1 parent
d953049
commit 66a9f16
Showing
3 changed files
with
165 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Flags: --no-warnings --test-name-pattern=suite-one>suite-two>subtest-one | ||
'use strict'; | ||
const common = require('../common'); | ||
const { | ||
after, | ||
afterEach, | ||
before, | ||
beforeEach, | ||
describe, | ||
it, | ||
test, | ||
} = require('node:test'); | ||
|
||
describe('suite-one', () => { | ||
before(common.mustCall()); | ||
beforeEach(common.mustCall(3)); | ||
afterEach(common.mustCall(3)); | ||
after(common.mustCall()); | ||
|
||
it('subtest-one', common.mustNotCall()); | ||
describe( | ||
'suite-two', | ||
common.mustCall(() => { | ||
it('subtest-one', common.mustCall()); | ||
}), | ||
); | ||
describe('suite-three', common.mustNotCall()); | ||
}); | ||
|
||
test( | ||
'suite-one', | ||
common.mustCall(async (t) => { | ||
t.beforeEach(common.mustCall(3)); | ||
t.afterEach(common.mustCall(3)); | ||
|
||
await t.test('subtest-one', common.mustNotCall()); | ||
await t.test( | ||
'suite-two', | ||
common.mustCall(async (t) => { | ||
await t.test('subtest-one', common.mustCall()); | ||
}), | ||
); | ||
await t.test('suite-three', common.mustNotCall()); | ||
}), | ||
); | ||
|
||
describe('excluded', () => { | ||
before(common.mustNotCall()); | ||
beforeEach(common.mustNotCall()); | ||
afterEach(common.mustNotCall()); | ||
after(common.mustNotCall()); | ||
|
||
it('subtest-one', common.mustNotCall()); | ||
describe('suite-two', common.mustNotCall()); | ||
}); | ||
|
||
test('excluded', (t) => { | ||
t.beforeEach(common.mustNotCall()); | ||
t.afterEach(common.mustNotCall()); | ||
|
||
t.test('subtest-one', common.mustNotCall()); | ||
t.test('suite-two', common.mustNotCall()); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
TAP version 13 | ||
# Subtest: suite-one | ||
# Subtest: subtest-one | ||
ok 1 - subtest-one # SKIP test name does not match pattern | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: suite-two | ||
# Subtest: subtest-one | ||
ok 1 - subtest-one | ||
--- | ||
duration_ms: * | ||
... | ||
1..1 | ||
ok 2 - suite-two | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: suite-three | ||
ok 3 - suite-three # SKIP test name does not match pattern | ||
--- | ||
duration_ms: * | ||
... | ||
1..3 | ||
ok 1 - suite-one | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: suite-one | ||
# Subtest: subtest-one | ||
ok 1 - subtest-one # SKIP test name does not match pattern | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: suite-two | ||
# Subtest: subtest-one | ||
ok 1 - subtest-one | ||
--- | ||
duration_ms: * | ||
... | ||
1..1 | ||
ok 2 - suite-two | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: suite-three | ||
ok 3 - suite-three # SKIP test name does not match pattern | ||
--- | ||
duration_ms: * | ||
... | ||
1..3 | ||
ok 2 - suite-one | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: excluded | ||
ok 3 - excluded # SKIP test name does not match pattern | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: excluded | ||
ok 4 - excluded # SKIP test name does not match pattern | ||
--- | ||
duration_ms: * | ||
... | ||
1..4 | ||
# tests 4 | ||
# pass 2 | ||
# fail 0 | ||
# cancelled 0 | ||
# skipped 2 | ||
# todo 0 | ||
# duration_ms * |