|
1 |
| -import { resolve, dirname, basename } from "node:path"; |
| 1 | +import { resolve, dirname, basename, join, relative } from "node:path"; |
2 | 2 |
|
3 | 3 | import { test as base } from "@playwright/test";
|
4 | 4 |
|
@@ -67,7 +67,8 @@ async function execute({ page, rlcache, plugins, template, extensions, coverage
|
67 | 67 | let hash = `step_${++id}`;
|
68 | 68 | let code = `window.${hash} = ${fn.toString()};`;
|
69 | 69 | let rootDir = dirname(testInfo.file);
|
70 |
| - let input = `${hash}_${basename(testInfo.file)}`; |
| 70 | + let relativePath = dirname(relative(process.cwd(), testInfo.file)); |
| 71 | + let input = join(relativePath, `${hash}_${basename(testInfo.file)}`); |
71 | 72 | inputs.push(input);
|
72 | 73 | files.push(ephemeral(input, code));
|
73 | 74 | let bundle = await rollup({
|
@@ -123,6 +124,7 @@ async function execute({ page, rlcache, plugins, template, extensions, coverage
|
123 | 124 | let params = [entry.fileName, hash, args];
|
124 | 125 | return await page.evaluateHandle(([src, hash, args]) => {
|
125 | 126 | return new Promise((resolve, reject) => {
|
| 127 | + /* globals window, document */ |
126 | 128 | let onload = () => resolve(window[hash](...args));
|
127 | 129 | let onerror = () => reject();
|
128 | 130 | let script = document.createElement("script");
|
|
0 commit comments