-
-
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.
feat: support running suites in parallel
- Loading branch information
Showing
3 changed files
with
48 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { describe, test } from 'vitest' | ||
|
||
const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)) | ||
|
||
// finishes in 3 sec | ||
// (1st and 2nd suites in parallel) | ||
describe('example-1', () => { | ||
// finishes in 3 sec | ||
// (1st and 2nd cases in serial) | ||
describe('1st suite', { concurrentSuite: true }, () => { | ||
test('1st case', async () => { | ||
await sleep(1000) | ||
}) | ||
test('2nd case', async () => { | ||
await sleep(2000) | ||
}) | ||
}) | ||
|
||
describe('2nd suite', { concurrentSuite: true }, () => { | ||
test('1st case', async () => { | ||
await sleep(1000) | ||
}) | ||
test('2nd case', async () => { | ||
await sleep(2000) | ||
}) | ||
}) | ||
}) | ||
|
||
// finishes in 3 sec | ||
// (same as example-1 but implemented as describe.each) | ||
describe('example-2', () => { | ||
describe.each(['1st suite', '2nd suite'])('%s', { concurrentSuite: true }, () => { | ||
test('1st case', async () => { | ||
await sleep(1000) | ||
}) | ||
test('2nd case', async () => { | ||
await sleep(2000) | ||
}) | ||
}) | ||
}) |
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