Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/smoke/book/render-book.test.ts
12921 views
1
import { testQuartoCmd } from "../../test.ts";
2
import { fileExists, noErrorsOrWarnings } from "../../verify.ts";
3
4
import { existsSync } from "../../../src/deno_ral/fs.ts";
5
import { join } from "../../../src/deno_ral/path.ts";
6
import { docs } from "../../utils.ts";
7
8
// Test a simple book
9
const input = docs("books/simple");
10
const verifySimple = [
11
fileExists(join(input, "_book", "Simple.pdf")),
12
fileExists(join(input, "_book", "index.html")),
13
fileExists(join(input, "_book", "search.json")),
14
fileExists(join(input, "_book", "site_libs")),
15
];
16
testQuartoCmd(
17
"render",
18
[input],
19
[noErrorsOrWarnings, ...verifySimple],
20
{
21
teardown: async () => {
22
const bookDir = join(input, "_book");
23
if (existsSync(bookDir)) {
24
await Deno.remove(bookDir, { recursive: true });
25
}
26
},
27
},
28
);
29
30
// Test a more complex book render
31
const vizInput = docs("books/visualization-curriculum");
32
const verifyViz = [
33
fileExists(
34
join(vizInput, "docs", "Visualization-Curriculum.docx"),
35
),
36
fileExists(
37
join(vizInput, "docs", "book-asciidoc", "Visualization-Curriculum.adoc"),
38
),
39
fileExists(join(vizInput, "docs", "index.html")),
40
];
41
testQuartoCmd(
42
"render",
43
[vizInput],
44
[noErrorsOrWarnings, ...verifyViz],
45
{
46
teardown: async () => {
47
const bookDir = join(vizInput, "docs");
48
if (existsSync(bookDir)) {
49
await Deno.remove(bookDir, { recursive: true });
50
}
51
},
52
},
53
);
54
55
// Note: Typst book tests have been moved to smoke-all infrastructure at
56
// tests/docs/smoke-all/typst/orange-book/index.qmd
57
58