-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(runner): nested tests should throw errors (#4262)
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 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,30 @@ | ||
import { describe, expect, test } from 'vitest' | ||
|
||
test('nested test should throw error', () => { | ||
expect(() => { | ||
test('test inside test', () => {}) | ||
}).toThrowErrorMatchingInlineSnapshot(`"Nested tests are not allowed"`) | ||
|
||
expect(() => { | ||
test.each([1, 2, 3])('test.each inside test %d', () => {}) | ||
}).toThrowErrorMatchingInlineSnapshot(`"Nested tests are not allowed"`) | ||
|
||
expect(() => { | ||
test.skipIf(false)('test.skipIf inside test', () => {}) | ||
}).toThrowErrorMatchingInlineSnapshot(`"Nested tests are not allowed"`) | ||
}) | ||
|
||
describe('parallel tests', () => { | ||
test.concurrent('parallel test 1 with nested test', () => { | ||
expect(() => { | ||
test('test inside test', () => {}) | ||
}).toThrowErrorMatchingInlineSnapshot(`"Nested tests are not allowed"`) | ||
}) | ||
test.concurrent('parallel test 2 without nested test', () => {}) | ||
test.concurrent('parallel test 3 without nested test', () => {}) | ||
test.concurrent('parallel test 4 with nested test', () => { | ||
expect(() => { | ||
test('test inside test', () => {}) | ||
}).toThrowErrorMatchingInlineSnapshot(`"Nested tests are not allowed"`) | ||
}) | ||
}) |