Error running tests from editor with jest 24.*
My tests are written in typescript. I use ts-jest to run the tests by clicking the green arrow in the left gutter. It has been working fine up util 23.6. But upgrading to 24.* breaks the tests. It throws errors like this:
Test suite failed to run
TypeError: Class constructor Spec cannot be invoked without 'new'
85 | function createdPatchedSpec(OriginalSpec, registry) {
86 | function PatchedSpec(attrs) {
> 87 | OriginalSpec.apply(this, arguments);
| ^
88 | if (attrs && attrs.id) {
89 | registry[attrs.id] = this;
90 | }
But when I run the test via `npm run test`, the tests are working fine.
Here is a reproduced example: https://github.com/laukaichung/test-fail
Please sign in to leave a comment.
https://youtrack.jetbrains.com/issue/WEB-37680 was fixed yesterday.
as a workaround, please try disabling
jest.test.tree.use.jasmine.reporter
registry key:jest.test.tree.use.jasmine.reporter
key and disable it.In version 2018.3.5 it hasn't been fixed yet. Had to use the work around
>In version 2018.3.5 it hasn't been fixed yet
No surprise - 2018.3.5 was released on February 27, 2019, and https://youtrack.jetbrains.com/issue/WEB-37680 was fixed on March, 11. We haven't yet invented a time machine, sorry
Somehow thats the latest version that I can download. I dont know why. So the fixed version is 2019.1?
Yes, exactly. Fix will be included in the next 2019.1 EAP (https://www.jetbrains.com/webstorm/eap/)
Thanks Elena for the workaround! Just ran into this myself. :)
Awesome! Workaround works!
Thanks for the Workaround Elena. Will it be included in the next 2018.* release? I really miss seeing the difference in my snapshot tests, and I don't want to jump into an EAP for work.
Yes, we plan to release 2018.3.6 update that will include the fix
many thanks Elena.
Thanks!!! :)
Elena thank you, workaround is working for me :)