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