Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onBrowserStart is not executed if the browser is restarted #3745

Open
arobinson opened this issue Jan 12, 2022 · 0 comments
Open

onBrowserStart is not executed if the browser is restarted #3745

arobinson opened this issue Jan 12, 2022 · 0 comments

Comments

@arobinson
Copy link

This issue was originally filed as #945
The problem is surfacing as a coverage failure and was filed as karma-runner/karma-coverage#434

The issue is that if the browser does not initially respond, the onBrowserStart function of the karma reporters is not fired.

This happens with high frequency with larger Angular projects. I believe the issue there is that the ng serve portion of ng test takes a while (the time it takes for the webpack dev server to start is quite long with large Angular projects). Karma considers this as chrome not responding. I think what is happening under the covers is that Chrome gives up trying to load the page and times out while trying to load a resource from the webpack dev server. Since chrome failed to load the page, karma then thinks that chrome is not responding.

This is seen in our CI builds when we don't get a coverage report:

START:
 12 01 2022 20:32:01.145:INFO [karma-server]: Karma v6.3.9 server started at http://localhost:9876/
 12 01 2022 20:32:01.145:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
 12 01 2022 20:32:01.152:INFO [launcher]: Starting browser Chrome
 12 01 2022 20:34:01.547:WARN [launcher]: Chrome has not captured in 120000 ms, killing.
 12 01 2022 20:34:04.784:WARN [launcher]: Chrome was not killed in 2000 ms, sending SIGKILL.
 12 01 2022 20:34:13.076:INFO [launcher]: Trying to start Chrome again (1/2).
 ✔ Browser application bundle generation complete.

The Browser application bundle generation complete. signifies when the webpack dev server finally started doing its job, so chrome has already died and been restarted.

The issue seemed to be documented well by this person's comment:
karma-runner/karma-coverage#434 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant