Merge branch 'keep-runner' of https://github.com/irium/grunt-contrib-jasmine
* '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:
commit
bd81d37009
@ -61,11 +61,15 @@ module.exports = function(grunt) {
|
|||||||
|
|
||||||
var done = this.async();
|
var done = this.async();
|
||||||
phantomRunner(options, function(err,status) {
|
phantomRunner(options, function(err,status) {
|
||||||
|
var success = !err && status.failed === 0;
|
||||||
|
|
||||||
if (err) grunt.log.error(err);
|
if (err) grunt.log.error(err);
|
||||||
if (status.failed === 0) grunt.log.ok('0 failures');
|
if (status.failed === 0) grunt.log.ok('0 failures');
|
||||||
else grunt.log.error(status.failed + ' failures');
|
else grunt.log.error(status.failed + ' failures');
|
||||||
|
|
||||||
|
options.keepRunner = options.keepRunner || !success;
|
||||||
teardown(options);
|
teardown(options);
|
||||||
done(!err && status.failed === 0);
|
done(success);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -96,8 +100,8 @@ module.exports = function(grunt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function teardown(options) {
|
function teardown(options) {
|
||||||
if (fs.statSync(options.outfile).isFile()) fs.unlink(options.outfile);
|
if (!options.keepRunner && fs.statSync(options.outfile).isFile()) fs.unlink(options.outfile);
|
||||||
jasmine.cleanTemp();
|
if (!options.keepRunner) jasmine.cleanTemp();
|
||||||
|
|
||||||
// Have to explicitly unregister nested wildcards. Need to file a bug for EventEmitter2
|
// Have to explicitly unregister nested wildcards. Need to file a bug for EventEmitter2
|
||||||
phantomjs.removeAllListeners('*');
|
phantomjs.removeAllListeners('*');
|
||||||
|
Loading…
Reference in New Issue
Block a user