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
Vitest+Typescript: TypeError: Cannot set property X of #<Y> which has only a getter #1494
Comments
I think this might be a problem with how we handle Errors. Vitest needs to serialize them. To do so we clone its properties - this is when your error happens. We are cloning error here, if someone wants to fix this:
|
Hello,
vitest : 0.15.1 |
I'm seeing the same error when using I thought this is an issue in Related: capricorn86/happy-dom#544 & capricorn86/happy-dom#545 |
I tried to recreate this issue without any luck, not all the required files are listed so its not clear. And repo at |
I've been getting this error everywhere when using |
Fixed with #1921 |
@sheremet-va any guess on when the next release will be out? 🥺 |
Describe the bug
I'm having some trouble and need some advice on creating a TS class with private/protected readonly members and have it pass my vitest tests.
asset.ts
stock.ts:
broker.test.ts
Result after running
vitest
:So, since I'm not the one setting the property explicit with a setter, I guess that's something vitest is doing somehow...
I can manage it to work if I remove the
readonly
modifier and create a setter for the propertuy, but I wonder if I can pass this error without having to make changes to my code.Any thoughts?
Thank you
Reproduction
(see example code above)
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: