-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Throwing in beforeAll
is ignored
#1213
Comments
Everything works with your reproduction: meaning, tests fail. https://stackblitz.com/edit/vitest-dev-vitest-xqtujg?file=test/suite.test.ts |
Aah, I see what is happening. I have multiple https://stackblitz.com/edit/vitest-dev-vitest-oycgdw?file=test%2Fsuite.test.ts In our current environment, our tests or dependent on the effects of their previous ones (not ideal, I know, but it's how it is for now) so if any block fails I would like to shown the error immediately and probably exit out. Is there a configuration we can use for that? |
This is not possible. describe blocks exist to prevent that :) Try moving your tests to the same describe block, or move |
Would it at least be possible to show the thrown errors immediately? I can see console logs/errors/etc. as soon as they run instead of after all tests have ended/timed out, and I did notice that I could see the errors if I essentially wrapped all of the functions in
but that seems excessive to have to do for the purposes of faster results/debugging https://stackblitz.com/edit/vitest-dev-vitest-oycgdw?file=test%2Fsuite.test.ts |
Depends on what reporter do you use? The base reporter dynamically updates the tree and only the relevant part is visible until every test is processed. We also have verbose reporter that shows the error immediately. |
I guess it would be possible to achieve with "bail" option from #1459. Closing this issue in favor of it. |
Describe the bug
I'm building out some tests for my project, and am trying to debug both the tests and the helper functions I'm building to setup the test states, etc.
While trying to debug why my tests weren't working, I discovered that if I throw an error inside of
beforeAll
, or return a promise that I reject, vitest seems to carry on as if everything completed successfully. This is making it extremely hard to debug tests, as well as disambiguate whether the problem is with my project, the test, or the test setup.Reproduction
or
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: