@vitest/browser-playwright 5.0.0-beta.7 → 5.0.0-rc.2
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/index.js +14 -3
- package/dist/locators.js +2 -0
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -944,6 +944,8 @@ function resolveLaunchOptions(browser, inspector, providerOptions, browserName)
|
|
|
944
944
|
return launchOptions;
|
|
945
945
|
}
|
|
946
946
|
class PlaywrightBrowserProvider {
|
|
947
|
+
project;
|
|
948
|
+
options;
|
|
947
949
|
name = "playwright";
|
|
948
950
|
supportsParallelism = true;
|
|
949
951
|
browser = null;
|
|
@@ -1106,8 +1108,8 @@ class PlaywrightBrowserProvider {
|
|
|
1106
1108
|
idPredicates.set(key, predicate);
|
|
1107
1109
|
await page.context().route(predicate, async (route) => {
|
|
1108
1110
|
if (module.type === "manual") {
|
|
1109
|
-
const exports
|
|
1110
|
-
const body = createManualModuleSource(module.url, exports
|
|
1111
|
+
const exports = Object.keys(await module.resolve());
|
|
1112
|
+
const body = createManualModuleSource(module.url, exports);
|
|
1111
1113
|
return route.fulfill({
|
|
1112
1114
|
body,
|
|
1113
1115
|
headers: getHeaders(this.project.browser.vite.config)
|
|
@@ -1263,6 +1265,13 @@ class PlaywrightBrowserProvider {
|
|
|
1263
1265
|
debug?.("[%s][%s] the page is ready", sessionId, this.browserName);
|
|
1264
1266
|
await this._throwIfClosing(page);
|
|
1265
1267
|
this.pages.set(sessionId, page);
|
|
1268
|
+
// fail the run immediately with an attributed error; otherwise the crash
|
|
1269
|
+
// is only visible as a websocket disconnect, if the browser closes it at all
|
|
1270
|
+
page.on("crash", () => {
|
|
1271
|
+
debug?.("[%s][%s] the page crashed", sessionId, this.browserName);
|
|
1272
|
+
const session = this.project.vitest._browserSessions.getSession(sessionId);
|
|
1273
|
+
session?.fail(new Error(`The ${this.browserName} page crashed while running tests. This can happen if the browser ran out of memory.`));
|
|
1274
|
+
});
|
|
1266
1275
|
if (process.env.VITEST_PW_DEBUG) {
|
|
1267
1276
|
page.on("requestfailed", (request) => {
|
|
1268
1277
|
console.error("[PW Error]", request.resourceType(), "request failed for", request.url(), "url:", request.failure()?.errorText);
|
|
@@ -1295,7 +1304,9 @@ class PlaywrightBrowserProvider {
|
|
|
1295
1304
|
send: cdp.send.bind(cdp),
|
|
1296
1305
|
on: cdp.on.bind(cdp),
|
|
1297
1306
|
off: cdp.off.bind(cdp),
|
|
1298
|
-
once: cdp.once.bind(cdp)
|
|
1307
|
+
once: cdp.once.bind(cdp),
|
|
1308
|
+
// For now this isn't typed as CDPSession but exposed only for `maybeCollectChromiumGarbage`
|
|
1309
|
+
detach: cdp.detach.bind(cdp)
|
|
1299
1310
|
};
|
|
1300
1311
|
}
|
|
1301
1312
|
async close() {
|
package/dist/locators.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/browser-playwright",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.0-
|
|
4
|
+
"version": "5.0.0-rc.2",
|
|
5
5
|
"description": "Browser running for Vitest using playwright",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"playwright": "*",
|
|
45
|
-
"vitest": "5.0.0-
|
|
45
|
+
"vitest": "5.0.0-rc.2"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"playwright": {
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"tinyrainbow": "^3.1.
|
|
54
|
-
"@vitest/browser": "5.0.0-
|
|
55
|
-
"@vitest/mocker": "5.0.0-
|
|
53
|
+
"tinyrainbow": "^3.1.1",
|
|
54
|
+
"@vitest/browser": "5.0.0-rc.2",
|
|
55
|
+
"@vitest/mocker": "5.0.0-rc.2"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"playwright": "^1.
|
|
59
|
-
"vitest": "5.0.0-
|
|
58
|
+
"playwright": "^1.62.1",
|
|
59
|
+
"vitest": "5.0.0-rc.2"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "premove dist && pnpm rollup -c",
|