Store in snapshot LOCs that errored

This commit is contained in:
dominik-zeglen 2020-02-26 13:57:04 +01:00
parent b8f0e55905
commit 4951db8b1c
2 changed files with 2841 additions and 5 deletions

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@ const readline = require("readline");
const updateSnapshot = process.argv.includes("-u"); const updateSnapshot = process.argv.includes("-u");
const snapshotPath = ".travis/check-strict-null-errors.snapshot"; const snapshotPath = ".travis/check-strict-null-errors.snapshot";
const shouldCount = /^src/; const shouldCount = /^src/;
let errors = 0; let errors = [];
const rl = readline.createInterface({ const rl = readline.createInterface({
input: process.stdin, input: process.stdin,
@ -16,14 +16,15 @@ const rl = readline.createInterface({
rl.on("line", line => { rl.on("line", line => {
if (shouldCount.test(line)) { if (shouldCount.test(line)) {
errors++; errors = [...errors, line];
} }
}); });
rl.on("close", () => { rl.on("close", () => {
const output = errors.join("\n") + "\n";
if (updateSnapshot) { if (updateSnapshot) {
fs.writeFileSync(snapshotPath, errors); fs.writeFileSync(snapshotPath, output);
} else { } else {
console.log(errors); console.log(output);
} }
}); });