fix: karma hangs after finishing tests successfully
After successfully finishing all tests, karma hangs for 30 sec with this message:
Chrome Headless 114.0.5735.35 (Windows 10) ERROR Disconnected , because no message in 30000 ms.
This only happens when executing more than approx. 620 tests. It looks like after the state went to DISCONNECTED in these cases there are still some log messages sent. The problem is that in this case also the timeout is restarted and the whole process obviously only terminates after the timer has expired. Therefore I've added an if clause which makes sure that the timer is only started when the state is not already 'DISCONNECTED'.
See more details here: https://stackoverflow.com/questions/76457941/karma-hangs-for-30-seconds-after-successfully-executing-unit-tests
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Thank you ! The only solution internet give for this problem is "Increase the timeout until it work", "increase browser inactivity timeout to 10min" it does not make sense. And finally found your PR, I can finally fix this problem with a real solution !