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
TypeError: Cannot read properties of undefined (reading 'stacks') #654
Comments
Cause of the problem: Zod error cannot be serialized using |
@patak-dev, I believe this error is back. I'm using vitest together with testing-library and jsdom. Some of my tests fail with: TypeError: Cannot read properties of undefined (reading 'stacks'). I narrowed the issue down to vitest not being able to handle jsdom/domexception errors. I have reproduced the issue by simply throwing a domexception error inside a test. import DOMException from "domexception";
import {it, describe} from 'vitest'
describe('The Index Page', () => {
it('should display content if no params are given', () => {
throw new DOMException("Something went wrong", "BadThingsError");
})
}) |
Same happens with crypto-js. |
Describe the bug
The library https://github.com/colinhacks/zod throws a ZodError when the parsing fails. Seems like this error is not well handled by vitest and crashes during a call to
parseStacktrace
.Reproduction
https://stackblitz.com/edit/node-xzljid?file=test%2Fbasic.test.ts&view=editor
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: