Unit test fails with an upgrade (NX Running target "test" failed)
See original GitHub issueInitially errored as follows,
● Test suite failed to run
The service is no longer running
at ../../../../node_modules/esbuild-wasm/lib/main.js:1276:29
at sendRequest (../../../../node_modules/esbuild-wasm/lib/main.js:625:14)
at start (../../../../node_modules/esbuild-wasm/lib/main.js:1274:9)
at ../../../../node_modules/esbuild-wasm/lib/main.js:1742:82
and then got below error with a bunch of tests failed,
NX Running target "test" failed
Tasks not run because their dependencies failed or --nx-bail=true
The failed jobs never attempted to run and simply fails. it’s happening only on the GitLab pipelines!.
is there anything changed on the affected:test that can cause this failure?
Can someone please advise on this?
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:21 (11 by maintainers)
Top Results From Across the Web
NX workspace - angular 14 - jest not working - Stack Overflow
5 . Running npm update succeeds now. But running the unit tests npm run nx run-many -- --target=test --projects= ...
Read more >nrwl-nx/community - Gitter
Hi, I'm trying to run affected:test but I'm getting errors: NX ERROR Running target "test" for affected projects failed . There is list...
Read more >@nrwl/jest:jest | Nx
Update snapshots running with --update-snapshot or -u for short. nx test my-project -u ... Exit the test suite immediately after n number of...
Read more >Unit test reports - GitLab Docs
If the tests fail, the pipeline fails and users get notified. The person that works on the merge request has to check the...
Read more >nx jest unexpected token 'export' - You.com | The AI Search ...
I use Jest to create and run the unit test used in my monorepo. Problem. When I run jest, on some test it...
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 FreeTop 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
Top GitHub Comments
I am affected by this too… tests all running locally but in Gitlab CI environment some run and some fail with an error similar to the original post:
Since update from Nx 13 to 14.
So did some more debugging today, this looks to be related to esbuild process getting killed via host system due to resource limits.
I did some investigation via nrwl/nx-examples/pull/209 and was able to get the error of esbuild trying to write to a close pipe
as for the fix here, I’m not 100% sure nx can do much. Some things to try is to lower the # of parallel threads running via
--parallel
flag and using the-runInBand
flag when running in CI, Other wise Jest will spin up worker threads that include running the esbuild transformer. You can also try bumping the memory on your CI agents.Now as to why the native esbuild binary isn’t able to run I’m not sure. There could be various reasons why esbuild native isn’t able to run like anti-virus incorrectly flagging it
jest-preset-angular falls back to esbuild-wasm if it cannot load esbuild, like angular. so that’s why it’s present, to begin with.
I would be interested if y’all could try some of the suggestions of lower the parallelism of nx and jest tests and seeing if the tests go away also checking if increasing the CI providers memory helps in any way.