Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/smoke/website/website-sidebar-auto.test.ts
12921 views
1
/*
2
* website-sidebar-auto.test.ts
3
*
4
* Verifies that sidebar auto-generation properly detects index files with
5
* non-qmd extensions (like .ipynb) in subdirectories. This tests the
6
* engineValidExtensions() call in indexFileHrefForDir() which must work
7
* before resolveEngines() has been called.
8
*
9
* Copyright (C) 2020-2025 Posit Software, PBC
10
*/
11
12
import { docs } from "../../utils.ts";
13
import { join } from "../../../src/deno_ral/path.ts";
14
import { existsSync } from "../../../src/deno_ral/fs.ts";
15
import { testQuartoCmd } from "../../test.ts";
16
import { fileExists, noErrorsOrWarnings } from "../../verify.ts";
17
18
const renderDir = docs("websites/website-sidebar-auto");
19
const outDir = join(Deno.cwd(), renderDir, "_site");
20
21
// Test that sidebar auto-generation detects index.ipynb in subdirectory
22
testQuartoCmd(
23
"render",
24
[renderDir],
25
[
26
noErrorsOrWarnings,
27
fileExists(join(outDir, "index.html")), // Main index page
28
fileExists(join(outDir, "subdir", "index.html")), // Subdir index from .ipynb should be rendered
29
],
30
{
31
teardown: async () => {
32
if (existsSync(outDir)) {
33
await Deno.remove(outDir, { recursive: true });
34
}
35
},
36
},
37
);
38
39