Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/smoke/inspect/inspect-recursive-include.test.ts
12921 views
1
/*
2
* inspect-recursive-include.test.ts
3
*
4
* Copyright (C) 2020-2024 Posit Software, PBC
5
*
6
*/
7
import { assertObjectMatch } from "https://deno.land/[email protected]/assert/assert_object_match.ts";
8
import { existsSync } from "../../../src/deno_ral/fs.ts";
9
import { FileInclusion } from "../../../src/project/types.ts";
10
import {
11
ExecuteOutput,
12
testQuartoCmd,
13
} from "../../test.ts";
14
import { assert, assertEquals } from "testing/asserts";
15
16
(() => {
17
const input = "docs/websites/issue-9253/index.qmd";
18
const output = "docs/websites/issue-9253/index.json";
19
testQuartoCmd(
20
"inspect",
21
[input, output],
22
[
23
{
24
name: "inspect-include",
25
verify: async (outputs: ExecuteOutput[]) => {
26
assert(existsSync(output));
27
const json = JSON.parse(Deno.readTextFileSync(output));
28
const info = json.fileInformation["docs/websites/issue-9253/index.qmd"];
29
const includeMap: FileInclusion[] = info.includeMap;
30
assertObjectMatch(info.includeMap[0], { target: "_include.qmd" });
31
assertObjectMatch(info.includeMap[1], { source: "_include.qmd", target: "_include2.qmd" });
32
}
33
}
34
],
35
{
36
teardown: async () => {
37
if (existsSync(output)) {
38
Deno.removeSync(output);
39
}
40
}
41
},
42
);
43
})();
44
45