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!: always run tests inside worker #1278

Closed
wants to merge 6 commits into from
Closed

feat!: always run tests inside worker #1278

wants to merge 6 commits into from

Conversation

antfu
Copy link
Member

@antfu antfu commented May 9, 2022

Breaking Changes

  • threads: false now runs all tests in the same worker, instead of the main process
  • the isolate option is now orthogonal to threads. By solely threads: false, the context will still be destroyed after each run. Combining threads: false and isolate: false to get the previous behavior of threads: false that context will leak across tests.
  • env options will now only affect the tests but not the main process's process.env

This PR is for the preparation of supporting multiple projects #256

@netlify
Copy link

netlify bot commented May 9, 2022

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit e073922
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/6279de60e2ada80009d3e9d4
😎 Deploy Preview https://deploy-preview-1278--vitest-dev.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 settings.

@antfu antfu changed the title feat: always run tests inside worker feat!: always run tests inside worker May 9, 2022
@antfu antfu marked this pull request as draft May 9, 2022 16:18
}

if (!ctx.config.isolate && !ctx.config.threads)
await runFiles(files) // single thread with no isolation
Copy link
Member

@sheremet-va sheremet-va May 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think --no-threads should always run all files in a single worker, otherwise there is no point in --no-threads. It's literally the same as running --threads - no alternative. And the name becomes misleading.

I think --isolate should just not affect --no-threads. Maybe in the future we might use vm.runInContext for isolation in --no-threads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants