mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: require comments on expectations (#12038)
This commit is contained in:
parent
7fe22b533d
commit
2ef161be3c
File diff suppressed because it is too large
Load Diff
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user