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

feat!(runner): support concurrent suites #5491

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Apr 5, 2024

Description

PoC of running multiple suites concurrently.

In terms of implementation, it looks like it's a matter of setting Suite.concurrent = true in some way. My current approach is to have an explicit flag TestOptions.concurrentSuite: boolean and the idea is based on the analogy:

  • describe("...", { concurrentSuite: true }, ...) to run neighboring suites concurrently
  • test("...", { concurrent: true }, ...) to run neighboring tests concurrently

TBD

  • comparison with Jest?
    • they runs all test.concurrent first whether it is inside describe and they have before/after hooks related bugs.
  • breaking change? (change describe.concurrent to affect all suite/task level concurrency)
  • limit concurrency only for tests but not for suites? otherwise, it's easy to make deadlock where outer concurrent describe is waiting for inner concurrent test to finish, then inner one is blocked by p-limit.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

Copy link

netlify bot commented Apr 5, 2024

Deploy Preview for fastidious-cascaron-4ded94 ready!

Name Link
🔨 Latest commit f52316b
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/663097c81736380008ade4e3
😎 Deploy Preview https://deploy-preview-5491--fastidious-cascaron-4ded94.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jgoux
Copy link
Contributor

jgoux commented Apr 9, 2024

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?

@hi-ogawa
Copy link
Contributor Author

hi-ogawa commented Apr 9, 2024

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?

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.

@hi-ogawa hi-ogawa marked this pull request as ready for review April 30, 2024 07:11
@sheremet-va sheremet-va added this to the 2.0.0 milestone May 2, 2024
@sheremet-va sheremet-va changed the title feat(runner): support concurrent suites feat!(runner): support concurrent suites May 2, 2024
@sheremet-va sheremet-va added the p2-to-be-discussed Enhancement under consideration (priority) label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-to-be-discussed Enhancement under consideration (priority)
Projects
Status: P2 - 4
Development

Successfully merging this pull request may close these issues.

concurrent.each executes iterations serially instead of concurrently
3 participants