Attemp fixing @babel/node and cli errors on Travis on Windows (#10547)
For some reason, it looks like that the rimraf call didn't properly delete
the folder:
EEXIST: file already exists, mkdir 'C:\Users\travis\build\babel\babel\packages\babel-node\test\tmp'
150 | process.chdir(__dirname);
151 | if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc);
> 152 | fs.mkdirSync(tmpLoc);
| ^
153 | process.chdir(tmpLoc);
154 | };
Lets try to reuse the existing folder rather than deleting and recreating it
This commit is contained in:
parent
06313a6288
commit
686186cabc
@ -115,13 +115,6 @@ const buildTest = function(binName, testName, opts) {
|
|||||||
const binLoc = path.join(__dirname, "../lib", binName);
|
const binLoc = path.join(__dirname, "../lib", binName);
|
||||||
|
|
||||||
return function(callback) {
|
return function(callback) {
|
||||||
const dir = process.cwd();
|
|
||||||
|
|
||||||
process.chdir(__dirname);
|
|
||||||
if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc);
|
|
||||||
fs.mkdirSync(tmpLoc);
|
|
||||||
process.chdir(tmpLoc);
|
|
||||||
|
|
||||||
saveInFiles(opts.inFiles);
|
saveInFiles(opts.inFiles);
|
||||||
|
|
||||||
let args = [binLoc];
|
let args = [binLoc];
|
||||||
@ -159,7 +152,6 @@ const buildTest = function(binName, testName, opts) {
|
|||||||
args.map(arg => `"${arg}"`).join(" ") + ": " + err.message;
|
args.map(arg => `"${arg}"`).join(" ") + ": " + err.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
process.chdir(dir);
|
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -175,6 +167,26 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) {
|
|||||||
|
|
||||||
const suiteLoc = path.join(fixtureLoc, binName);
|
const suiteLoc = path.join(fixtureLoc, binName);
|
||||||
describe("bin/" + binName, function() {
|
describe("bin/" + binName, function() {
|
||||||
|
let cwd;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cwd = process.cwd();
|
||||||
|
|
||||||
|
if (fs.existsSync(tmpLoc)) {
|
||||||
|
for (const child of fs.readdirSync(tmpLoc)) {
|
||||||
|
rimraf.sync(path.join(tmpLoc, child));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fs.mkdirSync(tmpLoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
process.chdir(tmpLoc);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
process.chdir(cwd);
|
||||||
|
});
|
||||||
|
|
||||||
fs.readdirSync(suiteLoc).forEach(function(testName) {
|
fs.readdirSync(suiteLoc).forEach(function(testName) {
|
||||||
if (testName.startsWith(".")) return;
|
if (testName.startsWith(".")) return;
|
||||||
|
|
||||||
|
|||||||
@ -99,7 +99,6 @@ const buildTest = function(binName, testName, opts) {
|
|||||||
const binLoc = path.join(__dirname, "../lib", binName);
|
const binLoc = path.join(__dirname, "../lib", binName);
|
||||||
|
|
||||||
return function(callback) {
|
return function(callback) {
|
||||||
clear();
|
|
||||||
saveInFiles(opts.inFiles);
|
saveInFiles(opts.inFiles);
|
||||||
|
|
||||||
let args = [binLoc];
|
let args = [binLoc];
|
||||||
@ -146,13 +145,6 @@ const buildTest = function(binName, testName, opts) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const clear = function() {
|
|
||||||
process.chdir(__dirname);
|
|
||||||
if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc);
|
|
||||||
fs.mkdirSync(tmpLoc);
|
|
||||||
process.chdir(tmpLoc);
|
|
||||||
};
|
|
||||||
|
|
||||||
fs.readdirSync(fixtureLoc).forEach(function(binName) {
|
fs.readdirSync(fixtureLoc).forEach(function(binName) {
|
||||||
if (binName[0] === ".") return;
|
if (binName[0] === ".") return;
|
||||||
|
|
||||||
@ -162,6 +154,16 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cwd = process.cwd();
|
cwd = process.cwd();
|
||||||
|
|
||||||
|
if (fs.existsSync(tmpLoc)) {
|
||||||
|
for (const child of fs.readdirSync(tmpLoc)) {
|
||||||
|
rimraf.sync(path.join(tmpLoc, child));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fs.mkdirSync(tmpLoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
process.chdir(tmpLoc);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user