feat!(runner): support concurrent suites#5491
Conversation
✅ Deploy Preview for fastidious-cascaron-4ded94 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
50eb8bf to
2597cd6
Compare
|
Hey @hi-ogawa, thanks for implementing it. I'm wondering why "concurrentSuite" is needed? Shouldn't we mimic jest and have all the describe blocks concurrent? Or is it for backward compat only? If people like me want jest behaviour on all describe blocks, could we add a concurrentSuite parameter in vitest.config.ts so it's enabled globally? |
I think I was mostly concerned with back compat, but anyways this PR is just for a starting point of discussion to explore the idea. Depending on what users expect and how Jest has been doing, we'll discuss further what this feature should be. |
| @@ -0,0 +1,41 @@ | |||
| import { describe, test, vi } from 'vitest' | |||
| import { createDefer } from 'vitest/dist/utils.js' | |||
There was a problem hiding this comment.
Why is it importing from dist 🤔
There was a problem hiding this comment.
Hmm, I didn't notice but it seems typescript got that one from autocomplete.
I installed @vitest/utils and it looks okay now.
Description
PoC of running multiple suites concurrently.
In terms of implementation, it looks like it's a matter of setting
Suite.concurrent = truein some way. My current approach is to have an explicit flagTestOptions.concurrentSuite: booleanand the idea is based on the analogy:describe("...", { concurrentSuite: true }, ...)to run neighboring suites concurrentlytest("...", { concurrent: true }, ...)to run neighboring tests concurrentlyTBD
comparison with Jest?test.concurrentfirst whether it is insidedescribeand they havebefore/afterhooks related bugs.describe.concurrentto affect all suite/task level concurrency)describeis waiting for inner concurrenttestto finish, then inner one is blocked byp-limit.TODO
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.