运行 Karma with Coverage 无法关闭 Firefox

Running Karma with Coverage is failing to shut down Firefox

我在 运行Windows10 上使用 Karma、Jasmin 和 Instanbul,并针对 ChromeHeadless、FireFoxHeadless 和 MS-Edge 进行测试。

所有测试 运行 都很好,并且写入了覆盖率输出。但是... Firefox 永远不会关闭。我收到此错误: WARN [launcher]: Firefox was not killed in 2000 ms, sending SIGKILL.

I have spent over 2 weeks trying to find an answer here on Whosebug and all over the internet. There were similar problems reported but no one ever had a definitive answer related to Firefox and Coverage.

太棒了!!!!!!!我想通了。

我问了某人一个问题,他们的回答让我想到了超时问题,我更改了 karma.conf.js 文件中的以下值,现在它可以正常工作了:

browserDisconnectTimeout: 10000, browserDisconnectTolerance: 1, processKillTimeout: 100000,

似乎覆盖率报告花费的时间太长了,只要延长超时时间就可以正常工作。默认超时为 2000 毫秒。

似乎与 Firefox 相关的东西需要更长的时间才能写出 Firefox 覆盖文件,并且花费的时间超过 2000 毫秒。这导致了我看到的错误。

增加超时允许写入所有内容并正确关闭 Firefox。