fix: try to catch unhandled error outside of a test#7968
Merged
sheremet-va merged 6 commits intovitest-dev:mainfrom May 13, 2025
Merged
fix: try to catch unhandled error outside of a test#7968sheremet-va merged 6 commits intovitest-dev:mainfrom
sheremet-va merged 6 commits intovitest-dev:mainfrom
Conversation
✅ Deploy Preview for vitest-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an unhandled error tracking issue by modifying error listener behavior, adding tests and updating documentation.
- Changes test files to validate unhandled error behavior.
- Updates the error listener logic in the runtime execution code.
- Updates documentation and snapshots to reflect the new error reporting behavior.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/core/test/unhandled.test.ts | Added test for unhandled promise error handling. |
| test/cli/test/snapshots/fails.test.ts.snap | Updated snapshot output for unhandled errors. |
| test/cli/fixtures/fails/unhandled-suite.test.ts | Added an additional test suite for unhandled errors. |
| packages/vitest/src/runtime/execute.ts | Modified error listener logic by removing the test-specific condition. |
| docs/guide/features.md | Added a documentation section on reporting uncaught errors. |
| docs/.vitepress/components/FeaturesList.vue | Updated feature list to include error reporting. |
| README.md | Updated feature list to include reporting of uncaught errors. |
Comments suppressed due to low confidence (1)
packages/vitest/src/runtime/execute.ts:60
- The removal of the test-specific error handling condition may affect how unhandled errors during tests are processed; please verify that this change does not inadvertently suppress errors that should be reported.
if (worker.current?.type === 'test') {
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #7940
TODO
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.