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

fix(@angular-devkit/build-angular): block Karma from starting until build is complete #22670

Merged
merged 1 commit into from
Feb 9, 2022
Merged

Conversation

alan-agius4
Copy link
Collaborator

This change is inspired by karma-runner/karma-chrome-launcher#154 (comment) which blocks Karma from launching the browsers until the compilation is complete.

This is needed especially for large applications when using code-coverage where otherwise the users would have to fine-tune several Karma timeouts such as captureTimeout for various environments.

Closes #22495

…uild is complete

This change is inspired by karma-runner/karma-chrome-launcher#154 (comment) which blocks Karma from launching the browsers until the compilation is complete.

This is needed especially for large applications when using code-coverage where otherwise the users would have to fine-tune several Karma timeouts such as  `captureTimeout` for various environments.

Closes #22495
@alan-agius4 alan-agius4 added the target: patch This PR is targeted for the next patch release label Feb 8, 2022
@alan-agius4 alan-agius4 marked this pull request as ready for review February 8, 2022 11:43
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: merge The PR is ready for merge by the caretaker labels Feb 8, 2022
let isFirstRun = true;

return new Promise<void>((resolve) => {
compiler.hooks.done.tap('karma', (stats) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if Karma fails? Will this callback still be executed or do we need a separate error handler to reject the Promise?

Copy link
Collaborator Author

@alan-agius4 alan-agius4 Feb 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant if webpack fails, yeah this will always be executed.

We don’t want to reject this promise because otherwise Karma will fail to start.

@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Feb 9, 2022
@filipesilva filipesilva merged commit 7ce5000 into angular:master Feb 9, 2022
@alan-agius4 alan-agius4 deleted the karma-block branch February 9, 2022 11:24
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chrome/karma is started before the webpack dev server is ready to serve
3 participants