-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Clear and concise description of the problem
Currently vitest fails a test run if it detects an unhandled rejection having been thrown:
Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
However, sometimes this is a desireable behaviour, especially when we are testing global unhandled rejection handlers.
Suggested solution
Several options are possible:
- Only report as a problem unhandled rejections that were not handled during the test execution (e. g. if there is no `process.on('unhandledRejection' handler that would consume the event);
- Make it possible to mark tests as expecting the unhandled rejections (e. g. syntax similar to
expect.assertions(1)-expect.unhandledRejections(1))
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Type
Projects
Status
P2 - 3