File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*
2+ * extension-dirs.test.ts
3+ *
4+ * Copyright (C) 2020-2026 Posit Software, PBC
5+ *
6+ */
7+
8+ import { unitTest } from "../test.ts" ;
9+ import { assert } from "testing/asserts" ;
10+ import { inputExtensionDirs } from "../../src/extension/extension.ts" ;
11+
12+ // Test for issue #14254: inputExtensionDirs should not hang when
13+ // projectDir is the filesystem root.
14+ // deno-lint-ignore require-await
15+ unitTest ( "extension-dirs - no infinite loop at filesystem root" , async ( ) => {
16+ const tempDir = Deno . makeTempDirSync ( { prefix : "quarto-test-ext" } ) ;
17+ const tempFile = `${ tempDir } /test.qmd` ;
18+ Deno . writeTextFileSync ( tempFile , "---\ntitle: test\n---\n" ) ;
19+
20+ // With projectDir = "/", the dirname loop must terminate at root.
21+ // If the root guard is missing, this call hangs forever.
22+ const dirs = inputExtensionDirs ( tempFile , "/" ) ;
23+ assert ( Array . isArray ( dirs ) , "inputExtensionDirs should return an array" ) ;
24+
25+ Deno . removeSync ( tempDir , { recursive : true } ) ;
26+ } ) ;
You can’t perform that action at this time.
0 commit comments