@vitest/browser-playwright 5.0.0-rc.1 → 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.
Files changed (2) hide show
  1. package/dist/index.js +10 -1
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1265,6 +1265,13 @@ class PlaywrightBrowserProvider {
1265
1265
  debug?.("[%s][%s] the page is ready", sessionId, this.browserName);
1266
1266
  await this._throwIfClosing(page);
1267
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
+ });
1268
1275
  if (process.env.VITEST_PW_DEBUG) {
1269
1276
  page.on("requestfailed", (request) => {
1270
1277
  console.error("[PW Error]", request.resourceType(), "request failed for", request.url(), "url:", request.failure()?.errorText);
@@ -1297,7 +1304,9 @@ class PlaywrightBrowserProvider {
1297
1304
  send: cdp.send.bind(cdp),
1298
1305
  on: cdp.on.bind(cdp),
1299
1306
  off: cdp.off.bind(cdp),
1300
- 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)
1301
1310
  };
1302
1311
  }
1303
1312
  async close() {
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-rc.1",
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-rc.1"
45
+ "vitest": "5.0.0-rc.2"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "playwright": {
@@ -51,12 +51,12 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "tinyrainbow": "^3.1.1",
54
- "@vitest/browser": "5.0.0-rc.1",
55
- "@vitest/mocker": "5.0.0-rc.1"
54
+ "@vitest/browser": "5.0.0-rc.2",
55
+ "@vitest/mocker": "5.0.0-rc.2"
56
56
  },
57
57
  "devDependencies": {
58
58
  "playwright": "^1.62.1",
59
- "vitest": "5.0.0-rc.1"
59
+ "vitest": "5.0.0-rc.2"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "premove dist && pnpm rollup -c",