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

feat(server): Add stop method #3153

Merged
merged 1 commit into from Oct 5, 2018

Conversation

filipesilva
Copy link
Contributor

Fix #3149

Copy link
Contributor

@johnjbarton johnjbarton left a comment

Choose a reason for hiding this comment

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

ok in principle

lib/server.js Outdated
@@ -302,6 +302,11 @@ class Server extends KarmaEventEmitter {
}
executor.schedule()
})

this.on('stop', function (done) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So 'stop' handler is only defined if config.autoWatch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought that made sense, since otherwise the server should stop anyway. Do you think it should always be available?

That would allow stopping a server that's taking too long in a single run. I don't have that usecase myself, but maybe others do.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think having the API go away when the config changes could be unnecessarily mysterious.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you're right. That would be confusing. Moved outside this condition.

lib/server.js Outdated
@@ -327,16 +332,17 @@ class Server extends KarmaEventEmitter {
done(code || 0)
}

this.emitAsync('exit').then(() => {
return this.emitAsync('exit').then(() => new Promise((resolve, reject) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would be clearer with an ArrowFunction

...() => {
      return new Promise...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm sorry, I don't understand. This is already an arrow function.

Do you mean adding the block to the arrow function instead of the return value directly?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes a function rather than an ArrowExpression

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, changed.

lib/server.js Outdated
@@ -302,6 +302,11 @@ class Server extends KarmaEventEmitter {
}
executor.schedule()
})

this.on('stop', function (done) {
this.log.debug('Exiting.')
Copy link
Contributor

Choose a reason for hiding this comment

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

How about 'Received stop event, exiting' or something that makes it clear why we exit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, will change.

@filipesilva filipesilva force-pushed the server-stop branch 2 times, most recently from 02681b4 to cd30eb6 Compare October 2, 2018 16:42
@johnjbarton johnjbarton merged commit 6d96d8e into karma-runner:master Oct 5, 2018
@filipesilva filipesilva deleted the server-stop branch October 8, 2018 07:56
@filipesilva
Copy link
Contributor Author

Awesome, thank you for taking the time to look at this!

filipesilva added a commit to filipesilva/angular-cli that referenced this pull request Oct 31, 2018
filipesilva added a commit to filipesilva/angular-cli that referenced this pull request Nov 1, 2018
filipesilva added a commit to filipesilva/angular-cli that referenced this pull request Nov 1, 2018
filipesilva added a commit to filipesilva/angular-cli that referenced this pull request Nov 1, 2018
filipesilva added a commit to filipesilva/angular-cli that referenced this pull request Nov 1, 2018
alexeagle pushed a commit to angular/angular-cli that referenced this pull request Nov 1, 2018
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

Successfully merging this pull request may close these issues.

None yet

2 participants