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

Add more information on what --threads does #1157

Closed
4 tasks done
sheremet-va opened this issue Apr 16, 2022 · 1 comment
Closed
4 tasks done

Add more information on what --threads does #1157

sheremet-va opened this issue Apr 16, 2022 · 1 comment
Labels
documentation Improvements or additions to documentation pr welcome

Comments

@sheremet-va
Copy link
Member

Clear and concise description of the problem

Documentation explain what threads config option does very poorly. We need to give a better description and it's difference from --runInBand in jest.

Suggested solution

  • Enables isolation, if there is no --no-isolate
  • If disabled, test files will run one after another

Is there anything more we could add?

Alternative

No response

Additional context

No response

Validations

@sheremet-va sheremet-va added documentation Improvements or additions to documentation pr welcome labels Apr 16, 2022
@sheremet-va
Copy link
Member Author

We've actually updated docs today, I forgot we have an open issue. For anyone wondering:

This option is different from Jest's --runInBand. Vitest uses workers not only for running tests in parallel, but also to provide isolation. By disabling this option, your tests will run sequentially, but in the same global context, so you must provide isolation yourself.

This might cause all sorts of issues, if you are relying on global state (frontend frameworks usually do) or your code relies on environment to be defined separately for each test (like, @vue/test-utils). But can be a speed boost for Node tests (up to 3 times faster), that don't necessarily rely on global state or can easily bypass that.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation pr welcome
Projects
None yet
Development

No branches or pull requests

1 participant