* 'keep-runner' of https://github.com/irium/grunt-contrib-jasmine:
  Don't remover spec runner on fail.
  Added option 'keepRunner' to keep spec runner after specs execution.
This commit is contained in:
Jarrod Overson 2013-04-04 10:39:04 -07:00
commit bd81d37009

View File

@ -61,11 +61,15 @@ module.exports = function(grunt) {
var done = this.async();
phantomRunner(options, function(err,status) {
var success = !err && status.failed === 0;
if (err) grunt.log.error(err);
if (status.failed === 0) grunt.log.ok('0 failures');
else grunt.log.error(status.failed + ' failures');
options.keepRunner = options.keepRunner || !success;
teardown(options);
done(!err && status.failed === 0);
done(success);
});
});
@ -96,8 +100,8 @@ module.exports = function(grunt) {
}
function teardown(options) {
if (fs.statSync(options.outfile).isFile()) fs.unlink(options.outfile);
jasmine.cleanTemp();
if (!options.keepRunner && fs.statSync(options.outfile).isFile()) fs.unlink(options.outfile);
if (!options.keepRunner) jasmine.cleanTemp();
// Have to explicitly unregister nested wildcards. Need to file a bug for EventEmitter2
phantomjs.removeAllListeners('*');