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;