We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Errors in Happy DOM are not catched by the Vitest error handler.
This works when using JSDOM as there is a listener on the window error event that emits "uncaughtException" on the Node.js process.
We can use the new Happy DOM setting disableErrorCapturing to achieve this.
This will also improve performance as try/catch which is used internally in Happy DOM by default can slow down execution.
Example 1
const script = document.createElement('script'); // Invalid code script.text = 'globalThis.test = /'; document.body.appendChild(script);
Example 2
setTimeout(() => { throw new Error('Error') });
Expected Vitest error handler to catch the error and invalidate the test.
Actual A console message with the error is outputted, but Vitest doesn't detect the error.
System: OS: Linux 6.2 Ubuntu 23.04 23.04 (Lunar Lobster) CPU: (4) x64 Intel(R) Core(TM) i5-7600K CPU @ 3.80GHz Memory: 6.86 GB / 15.57 GB Container: Yes Shell: 5.2.15 - /bin/bash Binaries: Node: 20.6.1 - ~/.nvm/versions/node/v20.6.1/bin/node npm: 9.8.1 - ~/.nvm/versions/node/v20.6.1/bin/npm Browsers: Chrome: 116.0.5845.187 Chromium: 116.0.5845.187
npm
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Describe the bug
Errors in Happy DOM are not catched by the Vitest error handler.
This works when using JSDOM as there is a listener on the window error event that emits "uncaughtException" on the Node.js process.
We can use the new Happy DOM setting disableErrorCapturing to achieve this.
This will also improve performance as try/catch which is used internally in Happy DOM by default can slow down execution.
Reproduction
Example 1
Example 2
Expected
Vitest error handler to catch the error and invalidate the test.
Actual
A console message with the error is outputted, but Vitest doesn't detect the error.
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: