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

 

 

 

5
12 comments

https://youtrack.jetbrains.com/issue/WEB-37680 was fixed yesterday.

as a workaround, please try disabling jest.test.tree.use.jasmine.reporter registry key:

  • "Help | Find Action..." on the main menu;
  • Type "registry" and click "Registry..." found element;
  • Find jest.test.tree.use.jasmine.reporter key and disable it.
16
Avatar
Permanently deleted user

In version 2018.3.5 it hasn't been fixed yet. Had to use the work around

1

>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

0
Avatar
Permanently deleted user

Somehow thats the latest version that I can download. I dont know why. So the fixed version is 2019.1?

0

Yes, exactly. Fix will be included in the next 2019.1 EAP (https://www.jetbrains.com/webstorm/eap/)

2

Thanks Elena for the workaround! Just ran into this myself. :) 

0

Awesome!  Workaround works!

0

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.

0

Yes, we plan to release 2018.3.6 update that will include the fix

2

many thanks Elena.

0

Thanks!!! :)

0
Avatar
Permanently deleted user

Elena thank you, workaround is working for me :)

0

Please sign in to leave a comment.