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:
24
scripts/rmExpected.js
Normal file
24
scripts/rmExpected.js
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user