-
Notifications
You must be signed in to change notification settings - Fork 434
Expand file tree
/
Copy pathsingle-file-engine-resolution.test.ts
More file actions
47 lines (42 loc) · 1.53 KB
/
single-file-engine-resolution.test.ts
File metadata and controls
47 lines (42 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* single-file-engine-resolution.test.ts
*
* Tests that singleFileProjectContext resolves engine extensions
* even without renderOptions (the preview code path).
* Related to issue #13983
*
* Copyright (C) 2026 Posit Software, PBC
*/
import { unitTest } from "../../test.ts";
import { assert } from "testing/asserts";
import { join } from "../../../src/deno_ral/path.ts";
import { singleFileProjectContext } from "../../../src/project/types/single-file/single-file.ts";
import { notebookContext } from "../../../src/render/notebook/notebook-context.ts";
import { initYamlIntelligenceResourcesFromFilesystem } from "../../../src/core/schema/utils.ts";
unitTest(
"singleFileProjectContext resolves engine extensions without renderOptions",
async () => {
await initYamlIntelligenceResourcesFromFilesystem();
const tmpDir = Deno.makeTempDirSync({ prefix: "quarto-test" });
const file = join(tmpDir, "test.qmd");
Deno.writeTextFileSync(
file,
"---\ntitle: test\nengine: julia\n---\n",
);
try {
const nbContext = notebookContext();
const project = await singleFileProjectContext(file, nbContext);
assert(
project.config !== undefined,
"config should be initialized even without renderOptions",
);
assert(
Array.isArray(project.config?.engines) &&
project.config.engines.length > 0,
"engine extensions should be resolved (bundled engines discovered)",
);
} finally {
Deno.removeSync(tmpDir, { recursive: true });
}
},
);