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

Run function when Karma test fails #609

Closed
bracketdash opened this issue Jun 28, 2013 · 1 comment
Closed

Run function when Karma test fails #609

bracketdash opened this issue Jun 28, 2013 · 1 comment

Comments

@bracketdash
Copy link

I've been scouring the internet today for a way to run some code whenever a Karma test fails with no luck. If there is a way to do this, could someone help me out? If there's not a way to do that currently, I guess this becomes a feature request.

Specifically, I'm working with Jasmine and I assume I would have to use the public API to start a server in Node. What I'm looking for is something like...

var server = require('karma').server;
server.start({port: 9877}, function(exitCode) {
  console.log('Karma has exitted with ' + exitCode);
  process.exit(exitCode);
});
server.onTestFail(function(tests){
  console.log('Test information collection follows...');
  console.log(tests);
});

Where the tests object would include which tests failed and any other information the log would normally have about the failed test.

@vojtajina
Copy link
Contributor

It sounds like you wanna create your own reporter. Check out other reporters for inspiration:
https://github.com/karma-runner/karma-growl-reporter
https://github.com/karma-runner/karma-junit-reporter

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

No branches or pull requests

2 participants