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

Karma doesn't exit when API is used with callback #1428

Closed
donaldpipowitch opened this issue May 28, 2015 · 3 comments
Closed

Karma doesn't exit when API is used with callback #1428

donaldpipowitch opened this issue May 28, 2015 · 3 comments

Comments

@donaldpipowitch
Copy link

I use Karma programmatically with its karma.server.start(config, cb) API. When I run my unit tests on a Selenium Grid the process runs forever, but only if I use a callback. That's why Karma seems to default to process.exit - it doesn't really stop without that. But the way I use it I can't know (and don't want to know) when Karma was called and when to call process.exit. I think this is a bug. It shouldn't be necessary to call process.exit, just to stop Karma.

@donaldpipowitch
Copy link
Author

Any update on this?

@donaldpipowitch
Copy link
Author

donaldpipowitch commented Jul 4, 2016

I have the same problem with 1.0.

I think this could be related to #1788. It randomely stays open for a while, event if cb is called. It would probably work, too, if I could stop my server manually, but it only has a start method.

@devoto13
Copy link
Collaborator

There were multiple changes targeting this problem and the minimal example works as intended now. I.e. cleans up all resources and exits without a process.exit() call.

const karma = require('karma')

karma.config.parseConfig('karma.conf.js', {}, { promiseConfig: true, throwErrors: true })
  .then((karmaConfig) => {
    const server = new karma.Server(karmaConfig, function doneCallback (exitCode) {
      console.log('Karma has exited with ' + exitCode)
      process.exit(exitCode)
    })
    server.start()
  })
  .catch((err) => console.error(err))

If you still experience the problem, please open a new issue with minimal reproduction and we'll look into fixing that specific case as well.

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

No branches or pull requests

3 participants