-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot run Jest tests from Webstorm #2314
Comments
We are having the same issue with Angular. |
Same here. I was able to configure with version NX 8.7.0, here is jest.config.js. Maybe it can be useful. Usage in webstormTo run within the webstorm you need to provide the Hope this issue can be fixed very soon :) |
@vladimirdrayling Very useful, thank you. I just had to make a new a new file called setup-test.ts with |
I think this one would be great to figure out... I've HAD this working with previous versions of nx, but just created brand new workspace with a new angular app... added I'm worried about the amount of hacking we've had to do historically in the past with older versions of nx... as I'm not sure its still able to run like its supposed to for run affected etc. Outside of webstorm, |
@vladimirdrayling, @raycashmore could you clarify what specifically you've changed from what came out of box NX? I'm definitely not seeing anything thats been able to fix ability to run tests from webstorm in the latest nx |
@ronnyek I have created nx-starter for my own purposes. Please, have a look to jest.config.js. This is the only file I've changed. WebStorm's Run/Debug Configurations |
@vladimirdrayling thanks! I feel like I needed to update more than just my jest.config.js, but was able to get things to work. Additionally, running outside the |
As I see the workaround is applying near the same configuraion as the jest builder does And it seems, that it could be solved from the nx console side (while generating the files). I wonder why builder was introduced in the first place? Does it only apply some sensible defaults? @vsavkin ^^^ |
FYI I believe the ability to use I think this problem is captured in a separate issue #2344 |
I think that this issue deserves some love. I had a workaround in place but it doesn't work anymore, so I'm currently forced to run my Jest tests outside of IJ/WebStorm, which is far from ideal :( |
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: |
Thank you @dsebastien. Your solution worked for me! |
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. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Prerequisites
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
app.component.spec.ts
with IntelliJ IDEA/WebStorm UI (Click on green triangle(s) near the line numbers).Failure Logs
The text was updated successfully, but these errors were encountered: