Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webstorm Jest Runner Broken #8118

Closed
ForsakenHarmony opened this issue Mar 13, 2019 · 11 comments
Closed

Webstorm Jest Runner Broken #8118

ForsakenHarmony opened this issue Mar 13, 2019 · 11 comments

Comments

@ForsakenHarmony
Copy link

馃挜 Regression Report

Webstorm has it's own jasmine reporter, it seems like due to the typescript rewrite classes got stricter and now it no longer runs as it did

    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 |     }

Last working version

Worked up to version:

24.1.0

Stopped working in version:

24.3.0

To Reproduce

Steps to reproduce the behavior:

Try to run a jest test suite in webstorm

Expected behavior

It runs the test suite fine like before

Link to repl or repo (highly encouraged)

Sadly somewhat hard to make a repl, I can't even revert back to the previous version because of all the semver ranges

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: Windows 10
    CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
  Binaries:
    Node: 11.10.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.8.0 - C:\Users\harmony\Code\Web\WebstormProjects\preact-cli\node_modules\.bin\npm.CMD
@SimenB
Copy link
Member

SimenB commented Mar 13, 2019

Yeah, it turned into an actual class. Can you report this on youtrack? Even if we revert the change, we'll want it back in the future

@Fannon
Copy link

Fannon commented Mar 13, 2019

This has already been fixed on IntelliJs side, but is not included in the latest EAP yet.

There is a workaround. Have a look in the IntelliJ ticket:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/360003251559-Error-running-tests-from-editor-with-jest-24-?page=1

@ForsakenHarmony
Copy link
Author

Problem is it's a breaking change in a minor release

@SimenB
Copy link
Member

SimenB commented Mar 13, 2019

It's not a public API - they are overriding internals. I don't think it should be expected for Jest to not be able to change its internals.

Their reporter should be a Jest reporter, not a refurbished Jasmine reporter. Jasmine will stop being the default runner in the next major of Jest, and will be removed at some point in the future.

I'm not sure if Jest's current reporter API provide the hooks needed for IntelliJ to do its thing. Happy to work with them to make it happen, if needed. I wanna revamp our reporters anyways, so this is a good time to look into IDE integrations (#4471 & #7900)

/cc @segrey

@segrey
Copy link

segrey commented Mar 13, 2019

The issue in IntelliJ tracker: https://youtrack.jetbrains.com/issue/WEB-37680.
Will be fixed in 2018.3.6 (ETA: end of March). Until then, please use the workaround.

@SimenB Yeah, IntelliJ can use both reporters: a Jest reporter and a Jasmine reporter. Jasmine reporter is preferred as it allows to fetch expected and actual values for failed assertions (useful for snapshot testing), see #5034. Another benefit is ability to receive events about started/finished tests during a single test file run (#4471): it allows to debug a test and see it and its output in the test tree.

It'd be great to extend Jest reporter API and switch to it in next IntelliJ versions. Looking forward to it :)

@SimenB
Copy link
Member

SimenB commented Mar 13, 2019

Awesome, thanks for those links @segrey! We're all meeting up in London next week, I'll be sure to come out with a plan for reporters after that. I added them to the Jest 25 milestone for now so I don't forget.

Just to be sure I understood correctly - the reason you prefer the jasmine reporter is that it provides information not available in the jest reporter? Concretely missing:

Anything else? And beyond parity with the Jasmine reporter, could we add something more you think would be useful?

@segrey
Copy link

segrey commented Mar 13, 2019

@SimenB Great! Regarding benefits of using Jasmine reporter, I don't have a complete list unfortunately.
Some of them I could recall:

  • An implication of sending events about describe/test/it: it allows to attach output to correct node in a test tree, and, when debugging, you can see live output of console.log/process.stdout.write.
  • Failed assertions provide separate compact error messages and error stacks whereas Jest reporter provides a single merged error message+stack making it's hard to show a compact error message for a failed element in the editor. It'd be great to provide separate values: expected/actual/message/stack.

@navyasrib
Copy link

The same issue is there with intellij as well

@tiarebalbi
Copy link

Just had the same issue with older version but updating to the latest version of IntelliJ and WebStorm the issue was fixed. This ticket seems to be good to be close.

@SimenB
Copy link
Member

SimenB commented Aug 16, 2019

Great, thanks!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants