-
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
Slow jest tests on Windows #1299
Comments
We have the same problem. tests run under 20s on my macbook pro, but take 300 seconds on my colleagues windows PC since upgrading nx and Jest 24 |
+1 tests are super slow on windows, can we get some support on this? |
Colleague of @ernie58 here with some more info It works fine if I use WSL with Debian and node on it. Since the tests also run fast on our Linux build agents, this seems like something Windows specific? |
@TomDobbelaere yes looks like Windows specific, on macOS it's OK too |
Any updates on this?
Worked for my team, thanks! |
Maybe not directly related but a friendly reminder, to check your antivirus software. In my case the new IntellIJ version has added some exclusions to Windows Defender and it has speed up my tests by over 30%. |
Any updates on this? I had the above working for NX 7.x, but upgrading now to 8.5 and coming across this issue again. @FrozenPandaz I believe there is still no way to pass the isolatedModules flag to the builder (without the hack?) |
@jdpearce I have just tested it, but it doens't look like it is merged. Without the hack the tests are still very very slow. This is my jest.config.js:
I did add it correct right? |
@evtk - apologies, the change I made hasn't actually been released yet! That Should be fixed in 8.5.1 though. |
no problems, it's great you took the effort to fix this. Will wait for the 8.5.1 though! |
@evtk - we've just released 8.5.1, can you try again? 🙏 |
wel this is interesting.. no matter what if I do or don't add the isolatedModules: true flag in the globals, jest seems to be somewhat quicker anyways! maybe is isolatedModules: true now a default? Though testing this on our CI server (windows devops) doesn't seem to do the trick. Too slow. edit: nah.. I tested some more and the global config from jest.config.js seems still overriden. |
@evtk 😞 I'll have to investigate this again, thanks for giving it a try! |
My team is also experiencing this problem on Windows machines. I temporarily fixed it using the isolatedModules workaround. Upgrading to Nrwl 8.5.1 from 8.5.0 didn't solve it for us either. |
@erik-slack check-in on this issue to get updates on merging the jest global config. |
With this PR merged into Jest, it should now be possible to set globals and have them persist. As a result, I'm going to close this issue for now. I'd suggest raising another issue if there is something else that can be done about this in Nx. Thanks to all for contributing on this thread. 👍 |
FYI: kulshekhar/ts-jest#1549 will be in alpha version of ts-jest (possibly today). You can test the alpha version and give some feedbacks for kulshekhar/ts-jest#1115 |
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. |
Expected Behavior
Tests are execetued fast on Windows
Current Behavior
Tests are exectued slow on Windows
Failure Information (for bugs)
Problem is with ts-jest which from version to version become slower and slower.
(I've written about it here: kulshekhar/ts-jest#259 (comment))
Steps to Reproduce
I've made sample repo to demonstrate the problem
https://github.com/Karql/angular-nx-slow-tests
Please read the README.md - every thing is in it.
Other
Only one work around I've found is set
isolatedModules: true
in ts-jest config.But for now there is now way to pass this option to JestBuilder
https://github.com/nrwl/nx/blob/625b2837a806e02709bdbe7b45ce3b131760448c/packages/jest/src/builders/jest/jest.builder.ts
To achieve it I've made hacky post install script which add this options:
Do you have any idea how to fix it?
In jest 24 there is native support for type script:
https://jestjs.io/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly
maybe this is the way? Please read the opinion one of the main ts-jest contributors kulshekhar/ts-jest#961 (comment)
Regards!
The text was updated successfully, but these errors were encountered: