Skip to content

Commit b540b69

Browse files
durrankangas
authored andcommitted
INT-1316 Don't rm -rf user-data in pretest
(cherry picked from commit e34f836)
1 parent d5bf337 commit b540b69

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"prestart": "node scripts/templatize.js && node scripts/prestart.js",
2828
"start": "node scripts/start.js",
2929
"//": "Run only the fast unit tests",
30-
"pretest": "rm -rf .user-data && node scripts/templatize.js",
30+
"pretest": "node scripts/templatize.js",
3131
"test": "xvfb-maybe node scripts/test.js",
3232
"prepublish": "node scripts/prepublish.js",
3333
"postuninstall": "node scripts/postuninstall.js",

scripts/test.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var path = require('path');
3333
var spawn = require('child_process').spawn;
3434
var which = require('which');
3535
var _ = require('lodash');
36+
var fs = require('fs-extra');
3637

3738
var args = [
3839
/**
@@ -74,15 +75,18 @@ var opts = {
7475
};
7576

7677
which('electron-mocha', function(err, bin) {
77-
cli.abortIfError(err);
78-
cli.debug('Using electron-mocha: ', bin);
78+
fs.remove(path.resolve(__dirname, '..', '.user-data'), function() {
79+
cli.debug('Removed .user-data directory');
80+
cli.abortIfError(err);
81+
cli.debug('Using electron-mocha: ', bin);
7982

80-
var proc = spawn(bin, args, opts);
81-
proc.stderr.pipe(process.stderr);
82-
proc.stdout.pipe(process.stdout);
83-
process.stdin.pipe(proc.stdin);
83+
var proc = spawn(bin, args, opts);
84+
proc.stderr.pipe(process.stderr);
85+
proc.stdout.pipe(process.stdout);
86+
process.stdin.pipe(proc.stdin);
8487

85-
proc.on('exit', function(code) {
86-
process.exit(code);
88+
proc.on('exit', function(code) {
89+
process.exit(code);
90+
});
8791
});
8892
});

0 commit comments

Comments
 (0)