Description
We are experiencing disconnects of the browser almost 100% of the time with karma-coverage
. It used to happen on occasion, but now it happens consistently. On a MacBookPro it rarely happens, but we do see the CPU hit hard and memory usage go up to large numbers (node process at 6GB and browser at 2.5-3 GB). On an 8GB AWS Linux EC2, the browser disconnects. In the past, before I disabled our code's console logging, it was not uncommon to core dump the chromium process during unit tests.
This is the error message we get:
00:53:47.061 Chrome Headless 112.0.5614.0 (Linux x86_64) ERROR
00:53:47.061 Disconnected reconnect failed before timeout of 2000ms (ping timeout)
00:53:47.061 Chrome Headless 112.0.5614.0 (Linux x86_64) ERROR
00:53:47.061 Disconnected reconnect failed before timeout of 2000ms (ping timeout)
00:53:47.061 Chrome Headless 112.0.5614.0 (Linux x86_64) ERROR
00:53:47.061 Disconnected reconnect failed before timeout of 2000ms (ping timeout)
Turning coverage off fixes the issue, but as a result we have no code coverage.
We are using karma-coverage
version 2.2.1
Angular environment:
Angular CLI: 16.2.4
Node: 18.17.0
Package Manager: pnpm 8.6.12
OS: darwin arm64
Angular: undefined
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1602.4
@angular-devkit/core 16.2.4
@angular-devkit/schematics 16.2.4
@schematics/angular 16.2.4
Karma coverage settings:
{
plugins: [karmaCoverage],
coverageReporter: {
type: 'html',
dir: coverageDirectory,
subdir: '.',
includeAllSources: true,
reporters: [
{ type: 'html', subdir: '.' },
{ type: 'lcov', projectRoot: projectDirectory }
] as any
}
}
Other karma settings:
{
browserDisconnectTimeout: 25_000,
browserDisconnectTolerance: 0,
browserNoActivityTimeout: 600_000,
captureTimeout: 600_000,
browserSocketTimeout: 19_200_000,
pingTimeout: 19_200_000,
processKillTimeout: 10_000
}
I've tried also disabling includeAllSources
. I've also played around with trying to exclude files to cover in the angular JSON using codeCoverageExclude
but no help
We have a large project, with ~550 spec files and 16,000 unit tests. Our source code, including the tests, is approximately 1 million lines of typescript code.
We are looking to potentially break up our code into Angular libraries in the future, but I'm looking for a more short-term work-around for this issue
Any assistance would be appreciated.