@vitest/browser 4.0.0-beta.6 → 4.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.
- package/dist/client/.vite/manifest.json +1 -1
- package/dist/client/__vitest__/assets/{index-B3LybwKR.js → index-CBcuRGkf.js} +28 -28
- package/dist/client/__vitest__/index.html +1 -1
- package/dist/client/__vitest_browser__/{tester-DSNROWDQ.js → tester-mSVktQ7a.js} +3 -0
- package/dist/client/error-catcher.js +7 -3
- package/dist/client/esm-client-injector.js +1 -0
- package/dist/client/tester/tester.html +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +6 -11
- package/package.json +8 -8
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
})();
|
|
24
24
|
</script>
|
|
25
25
|
<!-- !LOAD_METADATA! -->
|
|
26
|
-
<script type="module" src="./assets/index-
|
|
26
|
+
<script type="module" src="./assets/index-CBcuRGkf.js"></script>
|
|
27
27
|
<link rel="stylesheet" href="./assets/index-KbpJLW--.css">
|
|
28
28
|
</head>
|
|
29
29
|
<body>
|
|
@@ -3241,6 +3241,9 @@ async function prepare(options) {
|
|
|
3241
3241
|
});
|
|
3242
3242
|
})()
|
|
3243
3243
|
]);
|
|
3244
|
+
if (!config.browser.trackUnhandledErrors) {
|
|
3245
|
+
getBrowserState().disposeExceptionTracker();
|
|
3246
|
+
}
|
|
3244
3247
|
}
|
|
3245
3248
|
async function cleanup() {
|
|
3246
3249
|
const state = getWorkerState();
|
|
@@ -55,10 +55,14 @@ function catchWindowErrors(errorEvent, prop, cb) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
function registerUnexpectedErrors() {
|
|
58
|
-
catchWindowErrors('error', 'error', event =>
|
|
58
|
+
const offError = catchWindowErrors('error', 'error', event =>
|
|
59
59
|
reportUnexpectedError('Error', event.error))
|
|
60
|
-
catchWindowErrors('unhandledrejection', 'reason', event =>
|
|
60
|
+
const offRejection = catchWindowErrors('unhandledrejection', 'reason', event =>
|
|
61
61
|
reportUnexpectedError('Unhandled Rejection', event.reason))
|
|
62
|
+
return () => {
|
|
63
|
+
offError()
|
|
64
|
+
offRejection()
|
|
65
|
+
}
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
async function reportUnexpectedError(
|
|
@@ -71,4 +75,4 @@ async function reportUnexpectedError(
|
|
|
71
75
|
}).catch(console.error)
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
registerUnexpectedErrors()
|
|
78
|
+
globalThis.__vitest_browser_runner__.disposeExceptionTracker = registerUnexpectedErrors()
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" href="{__VITEST_FAVICON__}" type="image/svg+xml">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Vitest Browser Tester</title>
|
|
8
|
-
<script type="module" crossorigin src="/__vitest_browser__/tester-
|
|
8
|
+
<script type="module" crossorigin src="/__vitest_browser__/tester-mSVktQ7a.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/__vitest_browser__/utils-FY_Qin7d.js">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/dist/index.d.ts
CHANGED
|
@@ -130,7 +130,6 @@ declare class ParentBrowserProject {
|
|
|
130
130
|
project: TestProject;
|
|
131
131
|
base: string;
|
|
132
132
|
orchestratorScripts: string | undefined;
|
|
133
|
-
testerScripts: HtmlTagDescriptor[] | undefined;
|
|
134
133
|
faviconUrl: string;
|
|
135
134
|
prefixOrchestratorUrl: string;
|
|
136
135
|
prefixTesterUrl: string;
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import pm from 'pixelmatch';
|
|
|
22
22
|
import { WebSocketServer } from 'ws';
|
|
23
23
|
import { performance } from 'node:perf_hooks';
|
|
24
24
|
|
|
25
|
-
var version = "4.0.0-beta.
|
|
25
|
+
var version = "4.0.0-beta.8";
|
|
26
26
|
|
|
27
27
|
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
28
28
|
function normalizeWindowsPath(input = "") {
|
|
@@ -750,7 +750,7 @@ var BrowserPlugin = (parentServer, base = "/") => {
|
|
|
750
750
|
entries.push(project.config.diff);
|
|
751
751
|
}
|
|
752
752
|
if (parentServer.vitest.coverageProvider) {
|
|
753
|
-
const coverage = parentServer.vitest.
|
|
753
|
+
const coverage = parentServer.vitest._coverageOptions;
|
|
754
754
|
const provider = coverage.provider;
|
|
755
755
|
if (provider === "v8") {
|
|
756
756
|
const path = tryResolve("@vitest/coverage-v8", [parentServer.config.root]);
|
|
@@ -917,10 +917,6 @@ var BrowserPlugin = (parentServer, base = "/") => {
|
|
|
917
917
|
if (!projectBrowser) {
|
|
918
918
|
return;
|
|
919
919
|
}
|
|
920
|
-
if (!parentServer.testerScripts) {
|
|
921
|
-
const testerScripts = await parentServer.formatScripts(parentServer.config.browser.testerScripts);
|
|
922
|
-
parentServer.testerScripts = testerScripts;
|
|
923
|
-
}
|
|
924
920
|
const stateJs = typeof parentServer.stateJs === "string" ? parentServer.stateJs : await parentServer.stateJs;
|
|
925
921
|
const testerTags = [];
|
|
926
922
|
const isDefaultTemplate = resolve(distRoot, "client/tester/tester.html") === projectBrowser.testerFilepath;
|
|
@@ -1003,7 +999,6 @@ body {
|
|
|
1003
999
|
},
|
|
1004
1000
|
injectTo: "head"
|
|
1005
1001
|
} : null,
|
|
1006
|
-
...parentServer.testerScripts,
|
|
1007
1002
|
...testerTags
|
|
1008
1003
|
].filter((s) => s != null);
|
|
1009
1004
|
}
|
|
@@ -1054,7 +1049,8 @@ function getRequire() {
|
|
|
1054
1049
|
}
|
|
1055
1050
|
function resolveCoverageFolder(vitest) {
|
|
1056
1051
|
const options = vitest.config;
|
|
1057
|
-
const
|
|
1052
|
+
const coverageOptions = vitest._coverageOptions;
|
|
1053
|
+
const htmlReporter = coverageOptions?.enabled ? toArray(options.coverage.reporter).find((reporter) => {
|
|
1058
1054
|
if (typeof reporter === "string") {
|
|
1059
1055
|
return reporter === "html";
|
|
1060
1056
|
}
|
|
@@ -1064,7 +1060,7 @@ function resolveCoverageFolder(vitest) {
|
|
|
1064
1060
|
return undefined;
|
|
1065
1061
|
}
|
|
1066
1062
|
// reportsDirectory not resolved yet
|
|
1067
|
-
const root = resolve(options.root || process.cwd(),
|
|
1063
|
+
const root = resolve(options.root || process.cwd(), coverageOptions.reportsDirectory || coverageConfigDefaults.reportsDirectory);
|
|
1068
1064
|
const subdir = Array.isArray(htmlReporter) && htmlReporter.length > 1 && "subdir" in htmlReporter[1] ? htmlReporter[1].subdir : undefined;
|
|
1069
1065
|
if (!subdir || typeof subdir !== "string") {
|
|
1070
1066
|
return [root, `/${basename(root)}/`];
|
|
@@ -1677,7 +1673,7 @@ _Mime_extensionToType = new WeakMap(), _Mime_typeToExtension = new WeakMap(), _M
|
|
|
1677
1673
|
var mime = new Mime(types)._freeze();
|
|
1678
1674
|
|
|
1679
1675
|
function assertFileAccess(path, project) {
|
|
1680
|
-
if (!isFileServingAllowed(path, project.vite) && !isFileServingAllowed(path, project.vitest.
|
|
1676
|
+
if (!isFileServingAllowed(path, project.vite) && !isFileServingAllowed(path, project.vitest.vite)) {
|
|
1681
1677
|
throw new Error(`Access denied to "${path}". See Vite config documentation for "server.fs": https://vitejs.dev/config/server-options.html#server-fs-strict.`);
|
|
1682
1678
|
}
|
|
1683
1679
|
}
|
|
@@ -3083,7 +3079,6 @@ function wrapConfig(config) {
|
|
|
3083
3079
|
|
|
3084
3080
|
class ParentBrowserProject {
|
|
3085
3081
|
orchestratorScripts;
|
|
3086
|
-
testerScripts;
|
|
3087
3082
|
faviconUrl;
|
|
3088
3083
|
prefixOrchestratorUrl;
|
|
3089
3084
|
prefixTesterUrl;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/browser",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.8",
|
|
5
5
|
"description": "Browser running for Vitest",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"playwright": "*",
|
|
68
68
|
"webdriverio": "^7.0.0 || ^8.0.0 || ^9.0.0",
|
|
69
|
-
"vitest": "4.0.0-beta.
|
|
69
|
+
"vitest": "4.0.0-beta.8"
|
|
70
70
|
},
|
|
71
71
|
"peerDependenciesMeta": {
|
|
72
72
|
"playwright": {
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"sirv": "^3.0.1",
|
|
89
89
|
"tinyrainbow": "^2.0.0",
|
|
90
90
|
"ws": "^8.18.3",
|
|
91
|
-
"@vitest/mocker": "4.0.0-beta.
|
|
92
|
-
"@vitest/utils": "4.0.0-beta.
|
|
91
|
+
"@vitest/mocker": "4.0.0-beta.8",
|
|
92
|
+
"@vitest/utils": "4.0.0-beta.8"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@types/pngjs": "^6.0.5",
|
|
@@ -106,10 +106,10 @@
|
|
|
106
106
|
"playwright-core": "^1.54.1",
|
|
107
107
|
"safaridriver": "^1.0.0",
|
|
108
108
|
"webdriverio": "^9.18.4",
|
|
109
|
-
"@vitest/runner": "4.0.0-beta.
|
|
110
|
-
"@vitest/ui": "4.0.0-beta.
|
|
111
|
-
"@vitest/ws-client": "4.0.0-beta.
|
|
112
|
-
"vitest": "4.0.0-beta.
|
|
109
|
+
"@vitest/runner": "4.0.0-beta.8",
|
|
110
|
+
"@vitest/ui": "4.0.0-beta.8",
|
|
111
|
+
"@vitest/ws-client": "4.0.0-beta.8",
|
|
112
|
+
"vitest": "4.0.0-beta.8"
|
|
113
113
|
},
|
|
114
114
|
"scripts": {
|
|
115
115
|
"typecheck": "tsc -p ./src/client/tsconfig.json --noEmit",
|