Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/smoke/extensions/extension-render-journals.test.ts
12921 views
1
/*
2
* extension-render-journals.test.ts
3
*
4
* Copyright (C) 2020 by RStudio, PBC
5
*/
6
7
import { join } from "../../../src/deno_ral/path.ts";
8
import { quarto } from "../../../src/quarto.ts";
9
import { ensureDirSync, existsSync } from "../../../src/deno_ral/fs.ts";
10
import { testRender } from "../render/render.ts";
11
import { removeIfEmptyDir } from "../../../src/core/path.ts";
12
13
const journalRepos = [
14
// { repo: "acm", noSupporting: true }, TODO this format needs changes after this merge.
15
{ repo: "acs", noSupporting: true },
16
{ repo: "agu", noSupporting: true },
17
{ repo: "biophysical-journal", format: "bj", noSupporting: true },
18
{ repo: "elsevier", noSupporting: false },
19
{ repo: "jasa", noSupporting: true },
20
{ repo: "jss", noSupporting: true },
21
{ repo: "plos", noSupporting: true },
22
];
23
24
for (const journalRepo of journalRepos) {
25
const format = journalRepo.format || journalRepo.repo;
26
const baseDir = join(
27
"docs",
28
"_temp-test-artifacts",
29
);
30
const workingDir = join(baseDir, format);
31
const input = join(workingDir, `${format}.qmd`);
32
33
testRender(input, format + "-pdf", journalRepo.noSupporting, [], {
34
prereq: () => {
35
if (existsSync(workingDir)) {
36
Deno.removeSync(workingDir, { recursive: true });
37
}
38
ensureDirSync(workingDir);
39
return Promise.resolve(true);
40
},
41
42
// Sets up the test
43
setup: async () => {
44
console.log(`using quarto-journals/${journalRepo.repo}`);
45
const wd = Deno.cwd();
46
Deno.chdir(workingDir);
47
await quarto([
48
"use",
49
"template",
50
`quarto-journals/${journalRepo.repo}`,
51
"--no-prompt",
52
]);
53
Deno.chdir(wd);
54
},
55
56
// Cleans up the test
57
teardown: async () => {
58
await Deno.remove(workingDir, { recursive: true });
59
removeIfEmptyDir(baseDir);
60
},
61
});
62
}
63
64