@@ -35,10 +35,10 @@ import {
3535 ensureLatexFileRegexMatches ,
3636} from "../verify.ts" ;
3737import { readYaml , readYamlFromMarkdown } from "../../src/core/yaml.ts" ;
38- import { outputForInput } from "../utils.ts" ;
38+ import { findProjectDir , outputForInput } from "../utils.ts" ;
3939import { jupyterNotebookToMarkdown } from "../../src/command/convert/jupyter.ts" ;
4040import { basename , dirname , join , relative } from "../../src/deno_ral/path.ts" ;
41- import { existsSync , WalkEntry } from "fs/mod.ts" ;
41+ import { WalkEntry } from "fs/mod.ts" ;
4242import { quarto } from "../../src/quarto.ts" ;
4343import { safeExistsSync , safeRemoveSync } from "../../src/core/path.ts" ;
4444
@@ -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 ) ;
243+ const projectPath = findProjectDir ( input , / s m o k e - a l l $ / ) ;
244244 if ( projectPath ) testedProjects . add ( projectPath ) ;
245245
246246 // Render project before testing individual document if required
@@ -328,34 +328,11 @@ Promise.all(testFilesPromises).then(() => {
328328} ) . catch ( ( _error ) => { } ) ;
329329
330330
331- function findProjectDir ( input : string ) : string | undefined {
332- let dir = dirname ( input ) ;
333- // This is used for smoke-all tests and should stop there
334- // to avoid side effect of _quarto.yml outside of Quarto tests folders
335- while ( dir !== "" && dir !== "." && ! / s m o k e - a l l $ / . test ( dir ) ) {
336- const filename = [ "_quarto.yml" , "_quarto.yaml" ] . find ( ( file ) => {
337- const yamlPath = join ( dir , file ) ;
338- if ( existsSync ( yamlPath ) ) {
339- return true ;
340- }
341- } ) ;
342- if ( filename ) {
343- return dir ;
344- }
345-
346- const newDir = dirname ( dir ) ; // stops at the root for both Windows and Posix
347- if ( newDir === dir ) {
348- return ;
349- }
350- dir = newDir ;
351- }
352- }
353-
354331function findProjectOutputDir ( input ?: string , dir ?: string ) {
355332 if ( dir === undefined && input === undefined ) {
356333 throw new Error ( "Either input or dir must be provided" ) ;
357334 }
358- dir = dir ?? findProjectDir ( input ! ) ;
335+ dir = dir ?? findProjectDir ( input ! , / s m o k e - a l l $ / ) ;
359336 if ( ! dir ) {
360337 return ;
361338 }
0 commit comments