Path: blob/main/tests/smoke/extensions/extension-render-journals.test.ts
12921 views
/*1* extension-render-journals.test.ts2*3* Copyright (C) 2020 by RStudio, PBC4*/56import { join } from "../../../src/deno_ral/path.ts";7import { quarto } from "../../../src/quarto.ts";8import { ensureDirSync, existsSync } from "../../../src/deno_ral/fs.ts";9import { testRender } from "../render/render.ts";10import { removeIfEmptyDir } from "../../../src/core/path.ts";1112const journalRepos = [13// { repo: "acm", noSupporting: true }, TODO this format needs changes after this merge.14{ repo: "acs", noSupporting: true },15{ repo: "agu", noSupporting: true },16{ repo: "biophysical-journal", format: "bj", noSupporting: true },17{ repo: "elsevier", noSupporting: false },18{ repo: "jasa", noSupporting: true },19{ repo: "jss", noSupporting: true },20{ repo: "plos", noSupporting: true },21];2223for (const journalRepo of journalRepos) {24const format = journalRepo.format || journalRepo.repo;25const baseDir = join(26"docs",27"_temp-test-artifacts",28);29const workingDir = join(baseDir, format);30const input = join(workingDir, `${format}.qmd`);3132testRender(input, format + "-pdf", journalRepo.noSupporting, [], {33prereq: () => {34if (existsSync(workingDir)) {35Deno.removeSync(workingDir, { recursive: true });36}37ensureDirSync(workingDir);38return Promise.resolve(true);39},4041// Sets up the test42setup: async () => {43console.log(`using quarto-journals/${journalRepo.repo}`);44const wd = Deno.cwd();45Deno.chdir(workingDir);46await quarto([47"use",48"template",49`quarto-journals/${journalRepo.repo}`,50"--no-prompt",51]);52Deno.chdir(wd);53},5455// Cleans up the test56teardown: async () => {57await Deno.remove(workingDir, { recursive: true });58removeIfEmptyDir(baseDir);59},60});61}626364