-
Notifications
You must be signed in to change notification settings - Fork 331
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9997 from quarto-dev/fix/extensions/format-resour…
…ces-globs
- Loading branch information
Showing
11 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/docs/extensions/format-resources/9918/_extensions/test/_extension.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
title: Test | ||
author: Christophe Dervieux | ||
version: 1.0.0 | ||
quarto-required: ">=1.3" | ||
contributes: | ||
formats: | ||
html: | ||
format-resources: | ||
- folder-to-root | ||
- files-to-root/**/* | ||
- dummy-4.txt | ||
gfm: | ||
format-resources: folder-to-root |
1 change: 1 addition & 0 deletions
1
tests/docs/extensions/format-resources/9918/_extensions/test/dummy-4.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file should be copied to root project for rendering as it is included as a format-resources |
1 change: 1 addition & 0 deletions
1
tests/docs/extensions/format-resources/9918/_extensions/test/files-to-root/dummy-2.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file should be copied to root project for rendering as it is included as a format-resources |
1 change: 1 addition & 0 deletions
1
tests/docs/extensions/format-resources/9918/_extensions/test/files-to-root/dummy-3.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file should be copied to root project for rendering as it is included as a format-resources |
1 change: 1 addition & 0 deletions
1
tests/docs/extensions/format-resources/9918/_extensions/test/folder-to-root/dummy.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file should be copied to root project for rendering as it is included as a format-resources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: Untitled | ||
format: | ||
test-html: default | ||
test-gfm: default | ||
--- | ||
|
||
This document uses a test extension that should include nested resources | ||
|
33 changes: 33 additions & 0 deletions
33
tests/smoke/extensions/extension-render-format-resources.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* extension-render-doc.test.ts | ||
* | ||
* Copyright (C) 2020-2022 Posit Software, PBC | ||
* | ||
*/ | ||
|
||
import { safeRemoveSync } from "../../../src/core/path.ts"; | ||
import { dirname, join } from "../../../src/deno_ral/path.ts"; | ||
import { fileLoader } from "../../utils.ts"; | ||
import { fileExists, folderExists, pathDoNotExists } from "../../verify.ts"; | ||
import { testRender } from "../render/render.ts"; | ||
|
||
// This file uses custom formats 'test-html' provided by test extension | ||
const input = fileLoader("extensions/format-resources/9918")("index.qmd", "test-html"); | ||
const rootDir = dirname(input.input) | ||
const resourcesFile = [ | ||
join('folder-to-root', 'dummy.txt'), | ||
'dummy-2.txt', 'dummy-3.txt', 'dummy-4.txt', | ||
].map((x) => join(rootDir, x)) | ||
testRender(input.input, "test-html", false, | ||
[ | ||
folderExists(join(rootDir, "folder-to-root")), | ||
...resourcesFile.map(fileExists), | ||
pathDoNotExists(join(rootDir, "dummy.txt")), | ||
], | ||
{ | ||
teardown: () => { | ||
resourcesFile.forEach((x) => safeRemoveSync(x)); | ||
return Promise.resolve(); | ||
}, | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import { | |
} from "../../verify.ts"; | ||
import { safeRemoveSync } from "../../../src/core/path.ts"; | ||
import { safeExistsSync } from "../../../src/core/path.ts"; | ||
import { assert } from "../../../src/vendor/deno.land/[email protected]/assert/assert.ts"; | ||
|
||
export function testSimpleIsolatedRender( | ||
file: string, | ||
|
@@ -66,6 +67,12 @@ export function testRender( | |
verify, | ||
{ | ||
...context, | ||
setup: async () => { | ||
if (context?.setup) { | ||
await context?.setup(); | ||
} | ||
assert(safeExistsSync(input), `Input file ${input} does not exist. Test could not be ran.`); | ||
}, | ||
teardown: async () => { | ||
if (context?.teardown) { | ||
await context?.teardown(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters