Path: blob/main/tests/unit/project/single-file-engine-resolution.test.ts
12925 views
/*1* single-file-engine-resolution.test.ts2*3* Tests that singleFileProjectContext resolves engine extensions4* even without renderOptions (the preview code path).5* Related to issue #139836*7* Copyright (C) 2026 Posit Software, PBC8*/910import { unitTest } from "../../test.ts";11import { assert } from "testing/asserts";12import { join } from "../../../src/deno_ral/path.ts";13import { singleFileProjectContext } from "../../../src/project/types/single-file/single-file.ts";14import { notebookContext } from "../../../src/render/notebook/notebook-context.ts";15import { initYamlIntelligenceResourcesFromFilesystem } from "../../../src/core/schema/utils.ts";1617unitTest(18"singleFileProjectContext resolves engine extensions without renderOptions",19async () => {20await initYamlIntelligenceResourcesFromFilesystem();2122const tmpDir = Deno.makeTempDirSync({ prefix: "quarto-test" });23const file = join(tmpDir, "test.qmd");24Deno.writeTextFileSync(25file,26"---\ntitle: test\nengine: julia\n---\n",27);2829try {30const nbContext = notebookContext();31const project = await singleFileProjectContext(file, nbContext);3233assert(34project.config !== undefined,35"config should be initialized even without renderOptions",36);37assert(38Array.isArray(project.config?.engines) &&39project.config.engines.length > 0,40"engine extensions should be resolved (bundled engines discovered)",41);42} finally {43Deno.removeSync(tmpDir, { recursive: true });44}45},46);474849