@@ -268,10 +268,12 @@ async function runQuarto(
268268 cwd : string ,
269269 env ?: Record < string , string > ,
270270) : Promise < { success : boolean ; stdout : string ; stderr : string } > {
271+ const quartoCmd = Deno . build . os === "windows" ? "quarto.cmd" : "quarto" ;
271272 const quartoPath = join (
272273 Deno . cwd ( ) ,
273274 ".." ,
274- "package/dist/bin/quarto" ,
275+ "package/dist/bin" ,
276+ quartoCmd ,
275277 ) ;
276278 const result = await execProcess ( {
277279 cmd : quartoPath ,
@@ -432,7 +434,7 @@ unitTest(
432434 // analyzeNeededPackages catches the error and falls back to stageAll.
433435 const projectDir = join (
434436 Deno . cwd ( ) ,
435- "docs/smoke-all/typst/orange-book " ,
437+ "docs/smoke-all/typst/marginalia-only-project " ,
436438 ) ;
437439 const result = await runQuarto (
438440 [ "render" , "index.qmd" , "--to" , "typst" ] ,
@@ -443,27 +445,43 @@ unitTest(
443445 result . success ,
444446 `Expected render to succeed with fallback staging, but failed:\n${ result . stderr } ` ,
445447 ) ;
448+ // Clean up .quarto so fallback staging doesn't pollute subsequent tests
449+ const quartoDir = join ( projectDir , ".quarto" ) ;
450+ if ( existsSync ( quartoDir ) ) {
451+ Deno . removeSync ( quartoDir , { recursive : true } ) ;
452+ }
446453 } ,
447454) ;
448455
449456// Test 12: Staging falls back when typst-gather analyze fails (non-zero exit)
450457unitTest (
451458 "staging falls back when typst-gather analyze returns non-zero" ,
452459 async ( ) => {
453- // /usr/bin/false always exits with code 1
460+ // Use a real executable that will exit non-zero when called with
461+ // typst-gather's arguments. On Unix, /usr/bin/false always exits 1.
462+ // On Windows, use the quarto binary itself which will fail when called
463+ // with "analyze -" arguments.
464+ const falseCmd = Deno . build . os === "windows"
465+ ? Deno . execPath ( ) // deno binary will fail on "analyze -" args
466+ : "/usr/bin/false" ;
454467 const projectDir = join (
455468 Deno . cwd ( ) ,
456- "docs/smoke-all/typst/orange-book " ,
469+ "docs/smoke-all/typst/marginalia-only-project " ,
457470 ) ;
458471 const result = await runQuarto (
459472 [ "render" , "index.qmd" , "--to" , "typst" ] ,
460473 projectDir ,
461- { QUARTO_TYPST_GATHER : "/usr/bin/false" } ,
474+ { QUARTO_TYPST_GATHER : falseCmd } ,
462475 ) ;
463476 assert (
464477 result . success ,
465478 `Expected render to succeed with fallback staging, but failed:\n${ result . stderr } ` ,
466479 ) ;
480+ // Clean up .quarto so fallback staging doesn't pollute subsequent tests
481+ const quartoDir = join ( projectDir , ".quarto" ) ;
482+ if ( existsSync ( quartoDir ) ) {
483+ Deno . removeSync ( quartoDir , { recursive : true } ) ;
484+ }
467485 } ,
468486) ;
469487
0 commit comments