Closed ghost closed 2 years ago
Same, Angular, not just tests.
Same here :(
Managed to overcome this.
Edit configuration templates
(left bottom)Jest
Working directory
is a root directory of your projectManaged to overcome this.
- Open Edit Configuration
- Click on
Edit configuration templates
(left bottom)- Select
Jest
- Make sure
Working directory
is a root directory of your project
this works, but its still a bug - by default Webstorm grabs the nearest jest.config.js
file which is the one in the library and it extends the one in the root, so it should also work as same.
I have the same problem. The solution given by @npwork works, but it's still a bug because it's not working from the command line and CI workflow (github actions)
It is time consuming to figure out the workaround, and a bit awkward to always ensure that working-dir is set to root when running tests from a JetBrains product, so it would be very useful to have this issue fixed
I'm not 100% sure how this is an nx issue to fix since we cannot control where webstorm looks for a jest config.
as a side note, I've not run into this myself as a daily webstorm user which I find odd 🤔
Crashed headfirst into this today. An imported enum from a file in the same directory as the test spec fails. I tried some basic things, setting another const equal to the enum in the test itself, nothing worked. I had to put a note in the spec file that this is in fact using so-and-so enum but a bug is preventing the value of that enum from appearing properly.
Note that I'm not using Nx. I am however using webstorm. So it would seem this isn't on Nx.
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.
Current Behavior
Not sure its Nx related When running a unit test using Webstorm, it fails when the test includes an import of an enum** from a lib in the repo. However, if I only import an interface / class / type, it does not fail. When running
yarn test
everything passes successfully even with the enum.I searched for related tickets in ts-jest / babel-jest but couldn't find anything specific.
Expected Behavior
Tests will pass successfully
Steps to Reproduce
https://github.com/FrozenPandaz/nx-examples/tree/enum-jest
Failure Logs
Environment