Skip to content

feat(angular_devkit): stop blocking karma after compilation error - #11181

Merged
filipesilva merged 1 commit into
angular:masterfrom
nicojs:11170-dont-block-karma
Jun 10, 2018
Merged

feat(angular_devkit): stop blocking karma after compilation error#11181
filipesilva merged 1 commit into
angular:masterfrom
nicojs:11170-dont-block-karma

Conversation

@nicojs

@nicojs nicojs commented Jun 9, 2018

Copy link
Copy Markdown
Contributor

This PR removes the blocking of karma in case of compilation errors. This will not influence regular developer workflows (with ng test and ng test --single-run), but does help plugin creators relying on karma run functionality (with singleRun: false and watch: false).

Fixes #11170

@filipesilva

Copy link
Copy Markdown
Contributor

LGTM, thanks for improving this!

By the way, have you found a way to exit karma gracefully in a programmatic way? I haven't really found one that doesn't call process.exit.

@filipesilva
filipesilva merged commit a11dddf into angular:master Jun 10, 2018
@nicojs

nicojs commented Jun 10, 2018

Copy link
Copy Markdown
Contributor Author

By the way, have you found a way to exit karma gracefully in a programmatic way? I haven't really found one that doesn't call process.exit.

No, that isn't possible (that I know of). The only way documented way to stop karma is using karma.stopper.stop(options, [callback=process.exit]). This command sends an HTTP request to the karma server (for example: HTTP GET http://localhost:3456/stop).

The callback parameter defaults to process.exit so you might think that you can override that behavior. However, this is only the callback received by the caller. If you look at the middleware handling the http request, you can see that it always calls process.kill:
https://github.com/karma-runner/karma/blob/e8ca4ecefe92bd28494467503b09f3588b787cf7/lib/middleware/stopper.js#L13

In most cases (stryker, ng test, ...) the process hosting the karma server is also the process that would be sending the stop command, so the callback isn't even executed in those cases, as process.kill already happened. We designed Stryker around this by sand boxing test runners into separate processes.

Karma deserves some more love from the open source community. Unfortunately, I don't have the time for it.

Btw, when is the next release of the Angular CLI? I can't wait to try it out with Stryker.

@nicojs
nicojs deleted the 11170-dont-block-karma branch June 10, 2018 13:15
@filipesilva

Copy link
Copy Markdown
Contributor

Yeah that's the conclusion I got to as well, just wanted the double check if I was missing anything.

Next release of the CLI and devkit packages should be next week.

@nicojs

nicojs commented Jun 23, 2018

Copy link
Copy Markdown
Contributor Author

Next release of the CLI and devkit packages should be next week.

I see there is a new release:

image

However, the new code seems to be absent

image

@filipesilva Did something go wrong during release?

@nicojs

nicojs commented Jun 28, 2018

Copy link
Copy Markdown
Contributor Author

I see. It is released under the @next tag. Thanks for pointing that out to me @filipesilva, works like a charm!

@angular-automatic-lock-bot

Copy link
Copy Markdown

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 Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't block karma on webpack compilation errors

3 participants