babel/scripts/rmExpected.js
Andy 0545173f66 Test runner: Detect extra property in 'actual' but not in 'expected'. (#407)
* Test runner: Detect extra property in 'actual' but not in 'expected'.

Also update all expected.json where this would result in errors.

* Include rmExpected.js script in case it is needed again
2017-03-19 22:03:11 +01:00

25 lines
822 B
JavaScript

// Use this to remove all "expected.json" in all tests.
const { existsSync, readdirSync, statSync, unlinkSync } = require("fs");
const { join } = require("path");
const rootPath = join(__dirname, "..", "test", "fixtures");
for (const fixtureName of readdirSync(rootPath)) {
const fixturePath = join(rootPath, fixtureName);
for (const suiteName of readdirSync(fixturePath)) {
const suitePath = join(fixturePath, suiteName);
if (!statSync(suitePath).isDirectory()) {
continue;
}
for (const testName of readdirSync(suitePath)) {
const testPath = join(suitePath, testName);
const expectedPath = join(testPath, "expected.json");
if (existsSync(expectedPath)) {
unlinkSync(expectedPath);
}
}
}
}