Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions scripts/test-queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,31 @@ const allBlocks = files.flatMap((f) =>
const blocks = allBlocks.filter((b) =>
b.ann === 'skip' ? false : testAll ? true : b.ann !== null
);
const undecorated = allBlocks.length - blocks.length;
const skipped = allBlocks.filter((b) => !blocks.includes(b));
const undecorated = skipped.length;

function printSkipped() {
if (skipped.length === 0) return;
console.log(`${bold}Skipped${reset}`);
let lastFile = null;
for (const b of skipped) {
if (b.file !== lastFile) {
console.log(` ${cyan}${b.file}${reset}`);
lastFile = b.file;
}
const reason = b.ann === 'skip' ? 'sqltest: skip' : 'undecorated';
console.log(` ${yellow}-${reset}${dim}:${b.line}${reset} ${b.label} ${dim}(${reason})${reset}`);
}
console.log();
}

if (blocks.length === 0) {
console.log(
`No testable \`\`\`sql blocks found${fileFilter ? ` matching --file ${fileFilter}` : ''}` +
(undecorated ? ` (${undecorated} undecorated — add <!-- sqltest --> or pass --all)` : '') +
'.'
);
printSkipped();
process.exit(0);
}

Expand Down Expand Up @@ -161,9 +178,12 @@ for (const b of blocks) {
}
}

console.log();
printSkipped();

const passed = blocks.length - failed;
console.log(
`\n${bold}${failed ? red : green}${passed} passed${reset}${dim}, ${failed} failed` +
`${bold}${failed ? red : green}${passed} passed${reset}${dim}, ${failed} failed` +
(undecorated ? `, ${undecorated} undecorated/skipped` : '') +
reset
);
Expand Down
Loading