Skip to content

Commit f4daab4

Browse files
committed
regression test
1 parent 19cf9ef commit f4daab4

File tree

6 files changed

+44
-1
lines changed

6 files changed

+44
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
inner
2+
/.quarto/
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const hello = 'world';
2+
alert("We're here!");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import { hello } from './hello.js';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
format:
3+
html:
4+
embed-resources: true
5+
---
6+
7+
```{=html}
8+
<script type="module" src="./main.js"></script>
9+
```
10+
11+
## oh oh

tests/integration/playwright-tests.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,27 @@ await initState();
3232

3333
// const promises = [];
3434
const fileNames: string[] = [];
35+
const extraOpts = [
36+
{
37+
pathSuffix: "docs/playwright/embed-resources/issue-11860/main.qmd",
38+
options: ["--output-dir=inner"],
39+
}
40+
]
3541

3642
for (const { path: fileName } of globOutput) {
3743
const input = fileName;
44+
const options: string[] = [];
45+
for (const extraOpt of extraOpts) {
46+
if (fileName.endsWith(extraOpt.pathSuffix)) {
47+
options.push(...extraOpt.options);
48+
}
49+
}
3850

3951
// sigh, we have a race condition somewhere in
4052
// mediabag inspection if we don't wait all renders
4153
// individually. This is very slow..
4254
await execProcess({
43-
cmd: [quartoDevCmd(), "render", input],
55+
cmd: [quartoDevCmd(), "render", input, ...options],
4456
});
4557
fileNames.push(fileName);
4658
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { expect, Page, test } from "@playwright/test";
2+
3+
test("es6 modules to be bundled correctly in documents with embed-resources=true", async ({ page }) => {
4+
const messages: string[] = [];
5+
page.on('response', (response) => {
6+
if (!response.ok()) {
7+
messages.push(`[${response.status()}] ${response.url()}`);
8+
}
9+
});
10+
page.on('pageerror', (error) => {
11+
messages.push(`[${error.name}] ${error.message}`);
12+
});
13+
await page.goto('./embed-resources/issue-11860/inner/main.html');
14+
expect(messages).toStrictEqual([]);
15+
});

0 commit comments

Comments
 (0)