-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_runner: fix erroneous diagnostic warning when only: false
Co-author: rstagi <[email protected]> PR-URL: #54116 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
- Loading branch information
Showing
6 changed files
with
227 additions
and
7 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
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
40 changes: 40 additions & 0 deletions
40
test/fixtures/test-runner/output/test-diagnostic-warning-without-test-only-flag.js
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,40 @@ | ||
'use strict'; | ||
const { test, describe, it } = require('node:test'); | ||
|
||
describe('should NOT print --test-only diagnostic warning - describe-only-false', {only: false}, () => { | ||
it('only false in describe'); | ||
}); | ||
|
||
describe('should NOT print --test-only diagnostic warning - it-only-false', () => { | ||
it('only false in the subtest', {only: false}); | ||
}); | ||
|
||
describe('should NOT print --test-only diagnostic warning - no-only', () => { | ||
it('no only'); | ||
}); | ||
|
||
test('should NOT print --test-only diagnostic warning - test-only-false', {only: false}, async (t) => { | ||
await t.test('only false in parent test'); | ||
}); | ||
|
||
test('should NOT print --test-only diagnostic warning - t.test-only-false', async (t) => { | ||
await t.test('only false in subtest', {only: false}); | ||
}); | ||
|
||
test('should NOT print --test-only diagnostic warning - no-only', async (t) => { | ||
await t.test('no only'); | ||
}); | ||
|
||
test('should print --test-only diagnostic warning - test-only-true', {only: true}, async (t) => { | ||
await t.test('only true in parent test'); | ||
}) | ||
|
||
test('should print --test-only diagnostic warning - t.test-only-true', async (t) => { | ||
await t.test('only true in subtest', {only: true}); | ||
}); | ||
|
||
test('should print --test-only diagnostic warning - 2 levels of only', async (t) => { | ||
await t.test('only true in parent test', {only: false}, async (t) => { | ||
await t.test('only true in subtest', {only: true}); | ||
}); | ||
}) |
121 changes: 121 additions & 0 deletions
121
test/fixtures/test-runner/output/test-diagnostic-warning-without-test-only-flag.snapshot
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,121 @@ | ||
TAP version 13 | ||
# Subtest: should NOT print --test-only diagnostic warning - describe-only-false | ||
# Subtest: only false in describe | ||
ok 1 - only false in describe | ||
--- | ||
duration_ms: * | ||
... | ||
1..1 | ||
ok 1 - should NOT print --test-only diagnostic warning - describe-only-false | ||
--- | ||
duration_ms: * | ||
type: 'suite' | ||
... | ||
# Subtest: should NOT print --test-only diagnostic warning - it-only-false | ||
# Subtest: only false in the subtest | ||
ok 1 - only false in the subtest | ||
--- | ||
duration_ms: * | ||
... | ||
1..1 | ||
ok 2 - should NOT print --test-only diagnostic warning - it-only-false | ||
--- | ||
duration_ms: * | ||
type: 'suite' | ||
... | ||
# Subtest: should NOT print --test-only diagnostic warning - no-only | ||
# Subtest: no only | ||
ok 1 - no only | ||
--- | ||
duration_ms: * | ||
... | ||
1..1 | ||
ok 3 - should NOT print --test-only diagnostic warning - no-only | ||
--- | ||
duration_ms: * | ||
type: 'suite' | ||
... | ||
# Subtest: should NOT print --test-only diagnostic warning - test-only-false | ||
# Subtest: only false in parent test | ||
ok 1 - only false in parent test | ||
--- | ||
duration_ms: * | ||
... | ||
1..1 | ||
ok 4 - should NOT print --test-only diagnostic warning - test-only-false | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: should NOT print --test-only diagnostic warning - t.test-only-false | ||
# Subtest: only false in subtest | ||
ok 1 - only false in subtest | ||
--- | ||
duration_ms: * | ||
... | ||
1..1 | ||
ok 5 - should NOT print --test-only diagnostic warning - t.test-only-false | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: should NOT print --test-only diagnostic warning - no-only | ||
# Subtest: no only | ||
ok 1 - no only | ||
--- | ||
duration_ms: * | ||
... | ||
1..1 | ||
ok 6 - should NOT print --test-only diagnostic warning - no-only | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: should print --test-only diagnostic warning - test-only-true | ||
# Subtest: only true in parent test | ||
ok 1 - only true in parent test | ||
--- | ||
duration_ms: * | ||
... | ||
1..1 | ||
ok 7 - should print --test-only diagnostic warning - test-only-true | ||
--- | ||
duration_ms: * | ||
... | ||
# 'only' and 'runOnly' require the --test-only command-line option. | ||
# Subtest: should print --test-only diagnostic warning - t.test-only-true | ||
# Subtest: only true in subtest | ||
ok 1 - only true in subtest | ||
--- | ||
duration_ms: * | ||
... | ||
# 'only' and 'runOnly' require the --test-only command-line option. | ||
1..1 | ||
ok 8 - should print --test-only diagnostic warning - t.test-only-true | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: should print --test-only diagnostic warning - 2 levels of only | ||
# Subtest: only true in parent test | ||
# Subtest: only true in subtest | ||
ok 1 - only true in subtest | ||
--- | ||
duration_ms: * | ||
... | ||
# 'only' and 'runOnly' require the --test-only command-line option. | ||
1..1 | ||
ok 1 - only true in parent test | ||
--- | ||
duration_ms: * | ||
... | ||
1..1 | ||
ok 9 - should print --test-only diagnostic warning - 2 levels of only | ||
--- | ||
duration_ms: * | ||
... | ||
1..9 | ||
# tests 16 | ||
# suites 3 | ||
# pass 16 | ||
# fail 0 | ||
# cancelled 0 | ||
# skipped 0 | ||
# todo 0 | ||
# duration_ms * |
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