angularwindowsgoogle-chromekarma-runner

ng test fails midway with "[karma-server]: UnhandledRejection"


Today when I ran ng test on a project on Karma 4.4.1, I got the following error [karma-server]: UnhandledRejection and the tests stopped midway - "Executed 26 of 1371". Chrome appears and then disappears and the tests stop.

12 07 2022 11:43:34.087:ERROR [karma-server]: UnhandledRejection

What is causing this error and how can I fix it?


Solution

  • The solution is to downgrade to Node v14.

    This is because Karma (or at least Karma 4.4.1) is incompatible with Node 15 and above - see https://github.com/karma-runner/karma/issues/3570