async teardown and .grunt removal, closes #58
This commit is contained in:
parent
3bde360e05
commit
e622be01c6
@ -29,7 +29,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"grunt-lib-phantomjs": "~0.3.0",
|
"grunt-lib-phantomjs": "~0.3.0",
|
||||||
"rimraf": "~2.0.3"
|
"rimraf": "~2.1.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt-contrib-internal": "~0.4.0",
|
"grunt-contrib-internal": "~0.4.0",
|
||||||
|
@ -68,8 +68,9 @@ module.exports = function(grunt) {
|
|||||||
else grunt.log.error(status.failed + ' failures');
|
else grunt.log.error(status.failed + ' failures');
|
||||||
|
|
||||||
options.keepRunner = options.keepRunner || !success;
|
options.keepRunner = options.keepRunner || !success;
|
||||||
teardown(options);
|
teardown(options, function(){
|
||||||
done(success);
|
done(success);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -99,12 +100,12 @@ module.exports = function(grunt) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function teardown(options) {
|
function teardown(options, cb) {
|
||||||
if (!options.keepRunner && fs.statSync(options.outfile).isFile()) fs.unlink(options.outfile);
|
|
||||||
if (!options.keepRunner) jasmine.cleanTemp();
|
|
||||||
|
|
||||||
phantomjs.removeAllListeners();
|
phantomjs.removeAllListeners();
|
||||||
phantomjs.listenersAny().length = 0;
|
phantomjs.listenersAny().length = 0;
|
||||||
|
|
||||||
|
if (!options.keepRunner && fs.statSync(options.outfile).isFile()) fs.unlink(options.outfile);
|
||||||
|
if (!options.keepRunner) jasmine.cleanTemp(cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup(options) {
|
function setup(options) {
|
||||||
|
@ -24,8 +24,11 @@ exports.init = function(grunt, phantomjs) {
|
|||||||
grunt.file.copy(src, file);
|
grunt.file.copy(src, file);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.cleanTemp = function() {
|
exports.cleanTemp = function(cb) {
|
||||||
rimraf.sync(tempDir);
|
rimraf(tempDir, function(){
|
||||||
|
// if this fails, then ./.grunt isn't empty and that's ok.
|
||||||
|
fs.rmdir('.grunt', cb);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.buildSpecrunner = function (src, options){
|
exports.buildSpecrunner = function (src, options){
|
||||||
|
Loading…
Reference in New Issue
Block a user