Open suryart opened 2 years ago
Hi,
I am experiencing exactly the same issue in my project after upgrading it to Angular 14. It was working fine on Angular 12.
@suryart , if you find any work around, can you please share it?
A (hacky) workaround is to run the following before executing the tests:
sed -i -z "s/ removeAllListeners()\n/ removeAllListeners();process.nextTick(() => process.exit(code || 0));\n/g" node_modules/karma/lib/server.js
Hope this helps others that get stuck..
Thank you for sharing the hack @daniel-sc it worked for me with a minor adjustment!
So is this a fix that needs to happen in karma-browserstack-launcher
or karma
, or...?
@daniel-sc Running that before executing the tests worked perfectly! But I'm curious if there's an alternative solution/fix in place that would resolve this issue without having to run that script you shared?
I'm not aware of any real solution to this issue. It seems that nobody at Browserstack really cares about this.. 🤷♀️
A (hacky) workaround is to run the following before executing the tests:
sed -i -z "s/ removeAllListeners()\n/ removeAllListeners();process.nextTick(() => process.exit(code || 0));\n/g" node_modules/karma/lib/server.js
Hope this helps others that get stuck..
Thank you @daniel-sc I'm trying to use patch-package
to apply your solution. So, should the code looks like this?
Description
For Angular 14, when running the unit tests with Karma the process hangs after all tests finish successfully. As I can see the test getting completed on BrowserStack. Here is a session public link.
Here is an example repository created by @daniel-sc where issue can be reproduced.
Details for setting up and running the tests are in the example repository(link above).
Here is the link to log file.
What is happening?
When running the
npm run test-ci
the process is stuck after28 07 2022 18:24:35.692:DEBUG [launcher]: FINISHED -> FINISHED
log line.What is expected?
When the tests are finished the process should exit.