We have some projects still not using Jest version 23 yet(on Jest 19), after upgrading to IntelliJ Ultimate 2018.3, those tests refused to be run in the IDE environment.
When using IntelliJ Ultimate 2018.3 to run a single Jest test file, it seems to be using Jest-CLI parameters: `--runTestsByPath`
When running the tests from a package using Jest older than 23, the response is:
● Unrecognized CLI Parameters:
Following options were not recognized:
CLI Options Documentation:
Process finished with exit code 1
In IntelliJ Ultimate 2018.2.7, it uses parameters --testResultsProcessor and --testPathPattern which runs fine.
Please sign in to leave a comment.
Issue should be fixed in 2018.3.2: https://youtrack.jetbrains.com/issue/WEB-35242
I still see this error on 2018.3.4 Preview (Ultimate Edition).
Is there another workaround instead of waiting for the next IntelliJ update?
currently IDEA checks both jest and react-scripts versions trying to figure out the needded params. Seems it failes for your particular setup. Can you share a sample project that can be used to recreate the issue?
It might be that the jest-util npm package is not compatible with the latest IntelliJ version. Unfortunately my project is very large with many dependencies. I don't have an easy way to share a small sample without it breaking.
Here's the console error I'm seeing when debugging one Jest test (by clicking on green arrow next to line numbers in IntelliJ):
In an older version of IntelliJ (I don't remember the exact version), Jest debugging works fine and the console shows this command:
NOTE: this command was executed from a different development environment; directory paths may be different.
as I wrote, the cli args being used depend of the detected jest version. Looks as if it can be determined properly with your setup, thus the issue. We can hardly fix it unless we have a project that shows it up.
we don't need your proprietary code, it can be a single dummy test script. But the project setup should match yours, so that the problem can be replicated when using it
Running into the same problem on 2018.3.4. Our project setup is also pretty large too, so it would be difficult trying to isolate this into a test project. Did you guys find a solution?
Peter, due to time constraints, I downgraded to 2018.2.7 and haven't looked back. Good luck!
Noted. Thanks Eric!
Hi - I'm seeing this issue as well - my project is using react-app-rewired, and needs to run the jest bin bundled with that. I'm specifying this in the run configuration's jest package: '.../node_modules/react-app-rewired'
Could Idea use the jest version pointed at by the run configuration to figure out the needed params, instead of just looking in the jest and react-scripts folders as mentioned by Elena above?
it requires providing special support for react-app-rewired; please feel free to file a feature request for it to youtrack, https://youtrack.jetbrains.com/issues/WEB
Hi Elena - this is a regression. Running Jest tests using react-app-rewired works fine in Idea 2018.2.7. I don't think I should have to file a feature request for a feature that used to work in a previous version.
It's not a regression - as Jest cli has changed in new versions, we now have to somehow check what version is being used. It was not the case in Idea 2018.2.7 that only supported old cli args and didn't care about Jest version
Of course it is a regression. It's a feature that used to work in a previous version of your software and now no longer works in the new version, all other things being equal: https://en.wikipedia.org/wiki/Software_regression.
Your Jest runtime configuration supports selecting a custom Jest runtime. Given that, working out which command line params should be provided to that runtime should come from that runtime, not elsewhere. If that is not possible/easy, maybe another config item on the run configuration to disable the newer Jest command line params?
I can confirm that this is a regression, I'm having the same issue. I run Webstorm 2018.3.5. I tried Webstorm 2019.1 EAP, same issue, and rolled back to Webstorm 2018.2.7, which fixed the problem.
What version of Jest can I downgrade to so IntelliJ works again? All I did was upgrade IntelliJ and now all my unit tests won't run.
You need upgrading Jest, not downgrading it
Seems to be fixed in webstorm EAP 2019.2
Still an issue for us on 2019.2
Found a workaround. For whatever reason, we only have this problem with jest 23. Manually configuring our run/debug config to use jest 20 fixed the problem for us, since it's not misinterpreting the jest version as needing the newer config format.