Cannot run Jest tests from Webstorm
See original GitHub issuePrerequisites
- I am running the latest version
- I checked the documentation (nx.dev) and found no answer
- I checked to make sure that this issue has not already been filed
- I’m reporting the issue to the correct repository (not related to React, Angular or any dependency)
Expected Behavior
I just want to run the tests from app.component.spec.ts
from IntelliJ IDEA/WebStorm UI.
Current Behavior
I get an error.
Steps to Reproduce
- Generate a new workspace (Angular+Nest).
- Run any test (or all of them) from
app.component.spec.ts
with IntelliJ IDEA/WebStorm UI (Click on green triangle(s) near the line numbers).
Failure Logs
Error: Failed: "Zone is needed for the async() test helper but could not be found. Please make sure that your environment includes zone.js/dist/zone.js"
Error:
at Env.beforeEach (E:\testing\node_modules\jest-jasmine2\build\jasmineAsyncInstall.js:41:24)
at beforeEach (E:\testing\node_modules\jest-jasmine2\build\jasmine\jasmineLight.js:111:29)
at Suite.Object.<anonymous>.describe (E:\testing\apps\client\src\app\app.component.spec.ts:7:3)
at addSpecsToSuite (E:\testing\node_modules\jest-jasmine2\build\jasmine\Env.js:496:51)
at Env.describe (E:\testing\node_modules\jest-jasmine2\build\jasmine\Env.js:466:11)
at describe (E:\testing\node_modules\jest-jasmine2\build\jasmine\jasmineLight.js:81:18)
at Object.<anonymous> (E:\testing\apps\client\src\app\app.component.spec.ts:6:1)
at Runtime._execModule (E:\testing\node_modules\jest-runtime\build\index.js:867:68)
at Runtime._loadModule (E:\testing\node_modules\jest-runtime\build\index.js:577:12)
at Runtime.requireModule (E:\testing\node_modules\jest-runtime\build\index.js:433:10)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Jest | WebStorm Documentation - JetBrains
You can run and debug tests with Jest right in WebStorm. You can see the test results in a treeview and easily navigate...
Read more >Can't run Jest tests from editor in WebStorm - Stack Overflow
I can run Jest via a run configuration and it works fine. However, I can't right-click on a test in the editor and...
Read more >Troubleshooting - Jest
Tests are Failing and You Don't Know Why ... This will run Jest in a Node process that an external debugger can connect...
Read more >Running and debugging Jest tests in WebStorm | jsPoland 2018
Filmed at http://js-poland.pl 2018 on November 16 in Warsaw. Jest is a testing platform that is very popular for testing React applications.
Read more >[Solved]-Running jest tests directly in Intellij Idea/WebStorm?
[Solved]-Running jest tests directly in Intellij Idea/WebStorm?-Reactjs · Install Jest CLI: npm install --save-dev jest-cli · Create node run configuration with ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This solution works, but it’s a poor experience for new users onboarding to an existing repo. We have an large monorepo and each unique, one-off config like this makes onboarding more difficult.
I could make it work again with the following config, even though I’m really not sure of what’s going on and don’t have time now to dig deeper:
In my IDE, I have this as template for Jest tests: