Ensure that tests don't leave mutated global state in the environment.

This commit is contained in:
Logan Smyth
2018-02-06 23:12:19 -08:00
parent 85174b6ce1
commit d88173b9f8
4 changed files with 22 additions and 2 deletions

View File

@@ -177,6 +177,16 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) {
const suiteLoc = path.join(fixtureLoc, binName);
describe("bin/" + binName, function() {
let cwd;
beforeEach(() => {
cwd = process.cwd();
});
afterEach(() => {
process.chdir(cwd);
});
fs.readdirSync(suiteLoc).forEach(function(testName) {
if (testName[0] === ".") return;

View File

@@ -76,6 +76,16 @@ const buildTest = opts => {
};
describe("debug output", () => {
let cwd;
beforeEach(() => {
cwd = process.cwd();
});
afterEach(() => {
process.chdir(cwd);
});
fs.readdirSync(fixtureLoc).forEach(testName => {
if (testName.slice(0, 1) === ".") return;
const testLoc = path.join(fixtureLoc, testName);

View File

@@ -1,7 +1,7 @@
{
"presets": [
["../../../../lib", {
"configPath": "../fixtures/preset-options/browserslist-config",
"configPath": "packages/babel-preset-env/test/fixtures/preset-options/browserslist-config",
"modules": false
}]
]

View File

@@ -1,7 +1,7 @@
{
"presets": [
["../../../../lib", {
"configPath": "../fixtures/preset-options/browserslist-package",
"configPath": "packages/babel-preset-env/test/fixtures/preset-options/browserslist-package",
"targets": {
"chrome": 55
},