test: require comments on expectations (#12038)

This commit is contained in:
Alex Rudenko 2024-03-04 16:23:12 +01:00 committed by GitHub
parent 7fe22b533d
commit 2ef161be3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1056 additions and 519 deletions

File diff suppressed because it is too large Load Diff

View File

@ -120,6 +120,16 @@ testExpectations = testExpectations.filter(item => {
});
if (process.argv.includes('--lint')) {
const missingComments = [];
testExpectations.forEach(item => {
if (item.expectations.length === 1 && item.expectations[0] === 'PASS') {
return;
}
if (!item.comment) {
missingComments.push(item);
}
});
if (
JSON.stringify(committedExpectations) !== JSON.stringify(testExpectations)
) {
@ -128,6 +138,14 @@ if (process.argv.includes('--lint')) {
);
process.exit(1);
}
if (missingComments.length > 0) {
console.error(
`${source}: missing comments for the following expectations:`,
missingComments
);
process.exit(1);
}
} else {
fs.writeFileSync(
source,