@@ -34,8 +34,8 @@ import {
3434 ensurePptxMaxSlides ,
3535 ensureLatexFileRegexMatches ,
3636} from "../verify.ts" ;
37- import { readYaml , readYamlFromMarkdown } from "../../src/core/yaml.ts" ;
38- import { findProjectDir , outputForInput } from "../utils.ts" ;
37+ import { readYamlFromMarkdown } from "../../src/core/yaml.ts" ;
38+ import { findProjectDir , findProjectOutputDir , outputForInput } from "../utils.ts" ;
3939import { jupyterNotebookToMarkdown } from "../../src/command/convert/jupyter.ts" ;
4040import { basename , dirname , join , relative } from "../../src/deno_ral/path.ts" ;
4141import { WalkEntry } from "fs/mod.ts" ;
@@ -125,7 +125,7 @@ function resolveTestSpecs(
125125 verifyFns . push ( noErrors ) ;
126126 } else {
127127 // See if there is a project and grab it's type
128- const projectOutDir = findProjectOutputDir ( input ) ;
128+ const projectOutDir = findProjectOutputDir ( findSmokeAllProjectDir ( input ) ) ;
129129 const outputFile = outputForInput ( input , format , projectOutDir , metadata ) ;
130130 if ( key === "fileExists" ) {
131131 for (
@@ -240,7 +240,7 @@ for (const { path: fileName } of files) {
240240 }
241241
242242 // Get project path for this input and store it if this is a project (used for cleaning)
243- const projectPath = findProjectDir ( input , / s m o k e - a l l $ / ) ;
243+ const projectPath = findSmokeAllProjectDir ( input ) ;
244244 if ( projectPath ) testedProjects . add ( projectPath ) ;
245245
246246 // Render project before testing individual document if required
@@ -315,7 +315,7 @@ Promise.all(testFilesPromises).then(() => {
315315 // Clean up any projects that were tested
316316 for ( const project of testedProjects ) {
317317 // Clean project output directory
318- const projectOutDir = join ( project , findProjectOutputDir ( undefined , project ) ) ;
318+ const projectOutDir = join ( project , findProjectOutputDir ( project ) ) ;
319319 if ( safeExistsSync ( projectOutDir ) ) {
320320 safeRemoveSync ( projectOutDir , { recursive : true } ) ;
321321 }
@@ -327,28 +327,6 @@ Promise.all(testFilesPromises).then(() => {
327327 }
328328} ) . catch ( ( _error ) => { } ) ;
329329
330-
331- function findProjectOutputDir ( input ?: string , dir ?: string ) {
332- if ( dir === undefined && input === undefined ) {
333- throw new Error ( "Either input or dir must be provided" ) ;
334- }
335- dir = dir ?? findProjectDir ( input ! , / s m o k e - a l l $ / ) ;
336- if ( ! dir ) {
337- return ;
338- }
339- const yaml = readYaml ( join ( dir , "_quarto.yml" ) ) ;
340- let type = undefined ;
341- try {
342- // deno-lint-ignore no-explicit-any
343- type = ( ( yaml as any ) . project as any ) . type ;
344- } catch ( error ) {
345- throw new Error ( "Failed to read quarto project YAML" , error ) ;
346- }
347-
348- if ( type === "book" ) {
349- return "_book" ;
350- }
351- if ( type === "website" ) {
352- return ( yaml as any ) ?. project ?. [ "output-dir" ] || "_site" ;
353- }
330+ function findSmokeAllProjectDir ( input : string ) {
331+ return findProjectDir ( input , / s m o k e - a l l $ / ) ;
354332}
0 commit comments