-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Cannot exit Karma server gracefully #3149
Cannot exit Karma server gracefully #3149
Comments
What is the purpose of stopping the server without exiting the process? |
@johnjbarton running Karma as part of a larger pipeline. In a gulp task, you might want to do something after the server is stopped. Inside Angular CLI, we orchestrate build tasks as well. We cannot test karma plugin behavior on rebuilds because we are unable to gracefully stop karma. A specific usecase is that we want to test that our karma setup works on rebuilds, recovers from compilation errors, and does not trigger tests after a compilation with no changes. We set it up in https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/test/karma/rebuilds_spec_large.ts. While we can test other toolchains this way, we cannot test karma because it would cause our test runner to exit. |
@johnjbarton I added a tentative feature of how this could work in #3153. A user could call use it this way:
WDYT? |
When the Karma server is run programmatically, there is no way to request it to stop and be informed of when that has happened:
To reproduce, follow these steps:
Having a way to gracefully stop Karma is useful when the Karma run is part of more complex orchestration, like in
gulp
or@angular/cli
.There is a way to stop the server by calling
karma stop
, but that will kill the process altogether:karma/lib/middleware/stopper.js
Lines 11 to 13 in 6742ecf
There's some cleanup logic as well, but it only runs on
--single-run
:karma/lib/server.js
Lines 289 to 292 in 6742ecf
Related to #2867, ampproject/amphtml#14814
Environment Details
karma --version
): 3.0.0karma.config.js
file: included in repro, but nothing relevant in the config really.The text was updated successfully, but these errors were encountered: