@vitest/browser 2.0.0-beta.7 → 2.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
})()
|
|
18
18
|
</script>
|
|
19
19
|
<!-- !LOAD_METADATA! -->
|
|
20
|
-
<script type="module" crossorigin src="./assets/index-
|
|
20
|
+
<script type="module" crossorigin src="./assets/index-BZPCs_Bg.js"></script>
|
|
21
21
|
<link rel="stylesheet" crossorigin href="./assets/index-DrQA2UkS.css">
|
|
22
22
|
</head>
|
|
23
23
|
<body>
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,11 @@ import { fileURLToPath } from 'node:url';
|
|
|
2
2
|
import { readFile as readFile$1 } from 'node:fs/promises';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
4
|
import sirv from 'sirv';
|
|
5
|
+
import { isFileServingAllowed, getFilePoolName, distDir } from 'vitest/node';
|
|
5
6
|
import { coverageConfigDefaults } from 'vitest/config';
|
|
6
|
-
import { slash } from '@vitest/utils';
|
|
7
|
+
import { slash, toArray } from '@vitest/utils';
|
|
7
8
|
import fs, { promises } from 'node:fs';
|
|
8
9
|
import { resolve as resolve$1, dirname as dirname$1 } from 'node:path';
|
|
9
|
-
import { isFileServingAllowed } from 'vitest/node';
|
|
10
10
|
import MagicString from 'magic-string';
|
|
11
11
|
import { esmWalker } from '@vitest/utils/ast';
|
|
12
12
|
|
|
@@ -629,7 +629,7 @@ var index = (project, base = "/") => {
|
|
|
629
629
|
}
|
|
630
630
|
next();
|
|
631
631
|
});
|
|
632
|
-
let
|
|
632
|
+
let orchestratorScripts;
|
|
633
633
|
let testerScripts;
|
|
634
634
|
server.middlewares.use(async (req, res, next) => {
|
|
635
635
|
if (!req.url)
|
|
@@ -648,9 +648,11 @@ var index = (project, base = "/") => {
|
|
|
648
648
|
__VITEST_FILES__: JSON.stringify(files),
|
|
649
649
|
__VITEST_TYPE__: url.pathname === base ? '"orchestrator"' : '"tester"'
|
|
650
650
|
});
|
|
651
|
+
res.removeHeader("X-Frame-Options");
|
|
651
652
|
if (url.pathname === base) {
|
|
652
|
-
|
|
653
|
-
|
|
653
|
+
res.removeHeader("Content-Security-Policy");
|
|
654
|
+
if (!orchestratorScripts)
|
|
655
|
+
orchestratorScripts = await formatScripts(project.config.browser.orchestratorScripts, server);
|
|
654
656
|
let baseHtml = await orchestratorHtml;
|
|
655
657
|
if (project.config.browser.ui) {
|
|
656
658
|
const manifestContent = await manifest;
|
|
@@ -667,13 +669,17 @@ var index = (project, base = "/") => {
|
|
|
667
669
|
const html2 = replacer(baseHtml, {
|
|
668
670
|
__VITEST_FAVICON__: favicon,
|
|
669
671
|
__VITEST_TITLE__: "Vitest Browser Runner",
|
|
670
|
-
__VITEST_SCRIPTS__:
|
|
672
|
+
__VITEST_SCRIPTS__: orchestratorScripts,
|
|
671
673
|
__VITEST_INJECTOR__: injector
|
|
672
674
|
});
|
|
673
675
|
res.write(html2, "utf-8");
|
|
674
676
|
res.end();
|
|
675
677
|
return;
|
|
676
678
|
}
|
|
679
|
+
const csp = res.getHeader("Content-Security-Policy");
|
|
680
|
+
if (typeof csp === "string") {
|
|
681
|
+
res.setHeader("Content-Security-Policy", csp.replace(/frame-ancestors [^;]+/, "frame-ancestors *"));
|
|
682
|
+
}
|
|
677
683
|
const decodedTestFile = decodeURIComponent(url.pathname.slice(testerPrefix.length));
|
|
678
684
|
const testFiles = await project.globTestFiles();
|
|
679
685
|
const tests = decodedTestFile === "__vitest_all__" || !testFiles.includes(decodedTestFile) ? "__vitest_browser_runner__.files" : JSON.stringify([decodedTestFile]);
|
|
@@ -721,8 +727,22 @@ var index = (project, base = "/") => {
|
|
|
721
727
|
name: "vitest:browser:tests",
|
|
722
728
|
enforce: "pre",
|
|
723
729
|
async config() {
|
|
730
|
+
const allTestFiles = await project.globTestFiles();
|
|
731
|
+
const browserTestFiles = allTestFiles.filter((file) => getFilePoolName(project, file) === "browser");
|
|
732
|
+
const setupFiles = toArray(project.config.setupFiles);
|
|
733
|
+
const vitestPaths = [
|
|
734
|
+
resolve(distDir, "index.js"),
|
|
735
|
+
resolve(distDir, "browser.js"),
|
|
736
|
+
resolve(distDir, "runners.js"),
|
|
737
|
+
resolve(distDir, "utils.js")
|
|
738
|
+
];
|
|
724
739
|
return {
|
|
725
740
|
optimizeDeps: {
|
|
741
|
+
entries: [
|
|
742
|
+
...browserTestFiles,
|
|
743
|
+
...setupFiles,
|
|
744
|
+
...vitestPaths
|
|
745
|
+
],
|
|
726
746
|
exclude: [
|
|
727
747
|
"vitest",
|
|
728
748
|
"vitest/utils",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/browser",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.8",
|
|
5
5
|
"description": "Browser running for Vitest",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"playwright": "*",
|
|
49
49
|
"webdriverio": "*",
|
|
50
|
-
"vitest": "2.0.0-beta.
|
|
50
|
+
"vitest": "2.0.0-beta.8"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"playwright": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@testing-library/user-event": "^14.5.2",
|
|
66
66
|
"magic-string": "^0.30.10",
|
|
67
67
|
"sirv": "^2.0.4",
|
|
68
|
-
"@vitest/utils": "2.0.0-beta.
|
|
68
|
+
"@vitest/utils": "2.0.0-beta.8"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/ws": "^8.5.10",
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
"playwright-core": "^1.44.0",
|
|
78
78
|
"safaridriver": "^0.1.2",
|
|
79
79
|
"webdriverio": "^8.36.1",
|
|
80
|
-
"@vitest/
|
|
81
|
-
"vitest": "2.0.0-beta.
|
|
82
|
-
"@vitest/
|
|
83
|
-
"
|
|
80
|
+
"@vitest/runner": "2.0.0-beta.8",
|
|
81
|
+
"@vitest/ui": "2.0.0-beta.8",
|
|
82
|
+
"@vitest/ws-client": "2.0.0-beta.8",
|
|
83
|
+
"vitest": "2.0.0-beta.8"
|
|
84
84
|
},
|
|
85
85
|
"scripts": {
|
|
86
86
|
"build": "rimraf dist && pnpm build:node && pnpm build:client",
|