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
This commit is contained in:
Andy
2017-03-19 14:03:11 -07:00
committed by Daniel Tschinder
parent 82b7872cb8
commit 0545173f66
1379 changed files with 12566 additions and 11513 deletions

24
scripts/rmExpected.js Normal file
View File

@@ -0,0 +1,24 @@
// 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);
}
}
}
}