Skip to content

Commit

Permalink
tests - verify that input exists before doing any rendering
Browse files Browse the repository at this point in the history
this avoid unclear tests error due to file not found error when trying to render. `quarto render` errors, but the real errors is hidden behind faild assertion message otherwise
  • Loading branch information
cderv committed Jun 13, 2024
1 parent 784ad59 commit cec214c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/smoke/render/render.ts
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ import {
} from "../../verify.ts";
import { safeRemoveSync } from "../../../src/core/path.ts";
import { safeExistsSync } from "../../../src/core/path.ts";
import { assert } from "../../../src/vendor/deno.land/[email protected]/assert/assert.ts";

export function testSimpleIsolatedRender(
file: string,
@@ -66,6 +67,12 @@ export function testRender(
verify,
{
...context,
setup: async () => {
assert(safeExistsSync(input), `Input file ${input} does not exist. Test could not be ran.`);
if (context?.setup) {
await context?.setup();
}
},
teardown: async () => {
if (context?.teardown) {
await context?.teardown();

0 comments on commit cec214c

Please sign in to comment.