@vitest/browser 2.0.2 → 2.0.3
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.
- package/dist/client/.vite/manifest.json +1 -1
- package/dist/client/__vitest__/assets/{index-Cj9T8Z4J.js → index-gyhe06Cm.js} +27 -27
- package/dist/client/__vitest__/index.html +1 -1
- package/dist/client/__vitest_browser__/{orchestrator-BO1kzf5D.js → orchestrator-CNOAigTE.js} +16 -0
- package/dist/client/orchestrator.html +1 -1
- package/dist/index.js +3 -4
- package/package.json +7 -7
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
})();
|
|
23
23
|
</script>
|
|
24
24
|
<!-- !LOAD_METADATA! -->
|
|
25
|
-
<script type="module" crossorigin src="./assets/index-
|
|
25
|
+
<script type="module" crossorigin src="./assets/index-gyhe06Cm.js"></script>
|
|
26
26
|
<link rel="stylesheet" crossorigin href="./assets/index-Ct7j6Tgf.css">
|
|
27
27
|
</head>
|
|
28
28
|
<body>
|
package/dist/client/__vitest_browser__/{orchestrator-BO1kzf5D.js → orchestrator-CNOAigTE.js}
RENAMED
|
@@ -37,6 +37,9 @@ function createModuleMocker() {
|
|
|
37
37
|
http.get(/.+/, async ({ request }) => {
|
|
38
38
|
const path = cleanQuery(request.url.slice(location.origin.length));
|
|
39
39
|
if (!mocks.has(path)) {
|
|
40
|
+
if (path.includes("/deps/")) {
|
|
41
|
+
return fetch(bypass(request));
|
|
42
|
+
}
|
|
40
43
|
return passthrough();
|
|
41
44
|
}
|
|
42
45
|
const mock = mocks.get(path);
|
|
@@ -126,6 +129,19 @@ function passthrough() {
|
|
|
126
129
|
}
|
|
127
130
|
});
|
|
128
131
|
}
|
|
132
|
+
function bypass(request) {
|
|
133
|
+
const clonedRequest = request.clone();
|
|
134
|
+
clonedRequest.headers.set("x-msw-intention", "bypass");
|
|
135
|
+
const cacheControl = clonedRequest.headers.get("cache-control");
|
|
136
|
+
if (cacheControl) {
|
|
137
|
+
clonedRequest.headers.set(
|
|
138
|
+
"cache-control",
|
|
139
|
+
// allow reinvalidation of the cache so mocks can be updated
|
|
140
|
+
cacheControl.replace(", immutable", "")
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
return clonedRequest;
|
|
144
|
+
}
|
|
129
145
|
const postfixRE = /[?#].*$/;
|
|
130
146
|
function cleanUrl(url2) {
|
|
131
147
|
return url2.replace(postfixRE, "");
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
{__VITEST_INJECTOR__}
|
|
27
27
|
{__VITEST_ERROR_CATCHER__}
|
|
28
28
|
{__VITEST_SCRIPTS__}
|
|
29
|
-
<script type="module" crossorigin src="/__vitest_browser__/orchestrator-
|
|
29
|
+
<script type="module" crossorigin src="/__vitest_browser__/orchestrator-CNOAigTE.js"></script>
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/__vitest_browser__/preload-helper-Btt6SgIy.js">
|
|
31
31
|
</head>
|
|
32
32
|
<body>
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { createDebugger, isFileServingAllowed
|
|
1
|
+
import { createDebugger, isFileServingAllowed, getFilePoolName, resolveApiServerConfig, resolveFsAllow, distDir, createServer } from 'vitest/node';
|
|
2
2
|
import fs, { existsSync, readdirSync, readFileSync, promises } from 'node:fs';
|
|
3
3
|
import { WebSocketServer } from 'ws';
|
|
4
|
-
import { isFileServingAllowed } from 'vite';
|
|
5
4
|
import { builtinModules, createRequire } from 'node:module';
|
|
6
5
|
import { readFile as readFile$1, mkdir } from 'node:fs/promises';
|
|
7
6
|
import { fileURLToPath } from 'node:url';
|
|
@@ -1664,7 +1663,7 @@ const hover = async (context, selector, options = {}) => {
|
|
|
1664
1663
|
};
|
|
1665
1664
|
|
|
1666
1665
|
function assertFileAccess(path, project) {
|
|
1667
|
-
if (!isFileServingAllowed
|
|
1666
|
+
if (!isFileServingAllowed(path, project.server) && !isFileServingAllowed(path, project.ctx.server)) {
|
|
1668
1667
|
throw new Error(
|
|
1669
1668
|
`Access denied to "${path}". See Vite config documentation for "server.fs": https://vitejs.dev/config/server-options.html#server-fs-strict.`
|
|
1670
1669
|
);
|
|
@@ -2041,7 +2040,7 @@ var BrowserPlugin = (browserServer, base = "/") => {
|
|
|
2041
2040
|
next();
|
|
2042
2041
|
});
|
|
2043
2042
|
server.middlewares.use(async function vitestBrowserMode(req, res, next) {
|
|
2044
|
-
if (!req.url) {
|
|
2043
|
+
if (!req.url || !browserServer.provider) {
|
|
2045
2044
|
return next();
|
|
2046
2045
|
}
|
|
2047
2046
|
const url = new URL(req.url, "http://localhost");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/browser",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.3",
|
|
5
5
|
"description": "Browser running for Vitest",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"playwright": "*",
|
|
56
56
|
"webdriverio": "*",
|
|
57
|
-
"vitest": "2.0.
|
|
57
|
+
"vitest": "2.0.3"
|
|
58
58
|
},
|
|
59
59
|
"peerDependenciesMeta": {
|
|
60
60
|
"playwright": {
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"msw": "^2.3.1",
|
|
75
75
|
"sirv": "^2.0.4",
|
|
76
76
|
"ws": "^8.17.1",
|
|
77
|
-
"@vitest/utils": "2.0.
|
|
77
|
+
"@vitest/utils": "2.0.3"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@testing-library/jest-dom": "^6.4.6",
|
|
@@ -88,10 +88,10 @@
|
|
|
88
88
|
"playwright-core": "^1.45.0",
|
|
89
89
|
"safaridriver": "^0.1.2",
|
|
90
90
|
"webdriverio": "^8.39.0",
|
|
91
|
-
"@vitest/
|
|
92
|
-
"@vitest/
|
|
93
|
-
"@vitest/
|
|
94
|
-
"vitest": "2.0.
|
|
91
|
+
"@vitest/ws-client": "2.0.3",
|
|
92
|
+
"@vitest/runner": "2.0.3",
|
|
93
|
+
"@vitest/ui": "2.0.3",
|
|
94
|
+
"vitest": "2.0.3"
|
|
95
95
|
},
|
|
96
96
|
"scripts": {
|
|
97
97
|
"build": "rimraf dist && pnpm build:node && pnpm build:client",
|