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: apply runOnly on suites #48279

Closed
wants to merge 1 commit into from
Closed
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: 2 additions & 0 deletions lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,8 @@ class Suite extends Test {
constructor(options) {
super(options);

this.runOnlySubtests = testOnlyFlag;

try {
const { ctx, args } = this.getRunArgs();
const runArgs = [this.fn, ctx];
Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/test-runner/output/only_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ test('only = true, with subtests', { only: true }, async (t) => {
});

describe.only('describe only = true, with subtests', () => {
it('`it` subtest 1 should run', () => {});
it.only('`it` subtest 1 should run', () => {});

it('`it` subtest 2 should run', async () => {});
it('`it` subtest 2 should not run', async () => {});
});

describe.only('describe only = true, with a mixture of subtests', () => {
Expand Down Expand Up @@ -92,9 +92,9 @@ describe.only('describe only = true, with a mixture of subtests', () => {
});

describe.only('describe only = true, with subtests', () => {
test('subtest should run', () => {});
test.only('subtest should run', () => {});

test('async subtest should run', async () => {});
test('async subtest should not run', async () => {});

test('subtest should be skipped', { only: false }, () => {});
});
16 changes: 8 additions & 8 deletions test/fixtures/test-runner/output/only_tests.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ ok 11 - only = true, with subtests
---
duration_ms: *
...
# Subtest: `it` subtest 2 should run
ok 2 - `it` subtest 2 should run
# Subtest: `it` subtest 2 should not run
ok 2 - `it` subtest 2 should not run # SKIP 'only' option not set
---
duration_ms: *
...
Expand Down Expand Up @@ -155,7 +155,7 @@ ok 12 - describe only = true, with subtests
duration_ms: *
...
# Subtest: `it` subtest 3 skip
ok 5 - `it` subtest 3 skip # SKIP
ok 5 - `it` subtest 3 skip # SKIP 'only' option not set
---
duration_ms: *
...
Expand Down Expand Up @@ -185,7 +185,7 @@ ok 12 - describe only = true, with subtests
duration_ms: *
...
# Subtest: `test` subtest 3 skip
ok 11 - `test` subtest 3 skip # SKIP
ok 11 - `test` subtest 3 skip # SKIP 'only' option not set
---
duration_ms: *
...
Expand All @@ -206,8 +206,8 @@ ok 13 - describe only = true, with a mixture of subtests
---
duration_ms: *
...
# Subtest: async subtest should run
ok 2 - async subtest should run
# Subtest: async subtest should not run
ok 2 - async subtest should not run # SKIP 'only' option not set
---
duration_ms: *
...
Expand All @@ -225,9 +225,9 @@ ok 14 - describe only = true, with subtests
1..14
# tests 40
# suites 3
# pass 17
# pass 15
# fail 0
# cancelled 0
# skipped 23
# skipped 25
# todo 0
# duration_ms *