From 3800acd69c4cbc4d39b0ce86ee348efe57fac12a Mon Sep 17 00:00:00 2001 From: irium Date: Mon, 11 Mar 2013 19:07:03 +0400 Subject: [PATCH 1/2] Added option 'keepRunner' to keep spec runner after specs execution. --- tasks/jasmine.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/jasmine.js b/tasks/jasmine.js index 73808e2..0ee25c2 100644 --- a/tasks/jasmine.js +++ b/tasks/jasmine.js @@ -103,8 +103,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('*'); From d74c91c5046fa9620b105d32193bcad049fd5d6f Mon Sep 17 00:00:00 2001 From: irium Date: Mon, 11 Mar 2013 19:08:43 +0400 Subject: [PATCH 2/2] Don't remover spec runner on fail. --- tasks/jasmine.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tasks/jasmine.js b/tasks/jasmine.js index 0ee25c2..e1b01bb 100644 --- a/tasks/jasmine.js +++ b/tasks/jasmine.js @@ -69,11 +69,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); }); });