Skip to content

Commit 605f580

Browse files
committed
Fix hasTestSpecs to ignore run-only config
When _quarto.tests contains only 'run' with no format specs, hasTestSpecs() should return false to fall back to default behavior (guess formats, use noErrorsOrWarnings). This prevents tests with only run config from having no verification at all.
1 parent 2bb86f3 commit 605f580

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/smoke/smoke-all.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,16 @@ function skipTest(metadata: Record<string, any>): string | undefined {
125125

126126
//deno-lint-ignore no-explicit-any
127127
function hasTestSpecs(metadata: any, input: string): boolean {
128-
const hasTestSpecs = metadata?.["_quarto"]?.["tests"] != undefined
129-
if (!hasTestSpecs && metadata?.["_quarto"]?.["test"] != undefined) {
128+
const tests = metadata?.["_quarto"]?.["tests"];
129+
if (!tests && metadata?.["_quarto"]?.["test"] != undefined) {
130130
throw new Error(`Test is ${input} is using 'test' in metadata instead of 'tests'. This is probably a typo.`);
131131
}
132-
return hasTestSpecs
132+
// Check if tests has any format specs (keys other than 'run')
133+
if (tests && typeof tests === "object") {
134+
const formatKeys = Object.keys(tests).filter(key => key !== "run");
135+
return formatKeys.length > 0;
136+
}
137+
return false;
133138
}
134139

135140
interface QuartoInlineTestSpec {

0 commit comments

Comments
 (0)