@vitest/browser 5.0.4 → 5.0.5

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.
@@ -10,7 +10,7 @@
10
10
  "name": "defineProperty"
11
11
  },
12
12
  "orchestrator.html": {
13
- "file": "__vitest_browser__/orchestrator-Czo025Y6.js",
13
+ "file": "__vitest_browser__/orchestrator-C2U7TVD1.js",
14
14
  "name": "orchestrator",
15
15
  "src": "orchestrator.html",
16
16
  "isEntry": true,
@@ -228,13 +228,14 @@ Received URL: ${href || "unknown due to CORS"}\nExpected: ${iframe.src}`);
228
228
  watchUnload(iframe, iframeId) {
229
229
  var _iframe$contentWindow;
230
230
  const loads = this.iframeLoads.get(iframe) ?? 0;
231
- (_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 || _iframe$contentWindow.addEventListener("pagehide", () => {
231
+ (_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 || _iframe$contentWindow.addEventListener("pagehide", (event) => {
232
+ if (!event.isTrusted) return;
232
233
  setTimeout(() => {
233
234
  var _this$iframeEvents$ge;
234
235
  if (this.iframes.get(iframeId) !== iframe || !((_this$iframeEvents$ge = this.iframeEvents.get(iframe)) === null || _this$iframeEvents$ge === void 0 ? void 0 : _this$iframeEvents$ge.size) || this.iframeLoads.get(iframe) !== loads) return;
235
236
  this.dispatchIframeError(this.createConnectError(iframe, this.getIframeHref(iframe)));
236
237
  }, IFRAME_UNLOAD_TIMEOUT);
237
- }, { once: true });
238
+ });
238
239
  }
239
240
  createWarningMessage(iframeId, location) {
240
241
  return `The iframe${iframeId === ID_ALL ? "" : ` for "${iframeId}"`} was reloaded ${location}. This can lead to unexpected behavior during tests, duplicated test results or tests hanging.\n\nMake sure that your test code does not change window's location, submit forms without preventing default behavior, or imports unoptimized dependencies.\nIf you are using a framework that manipulates browser history (like React Router), consider using memory-based routing for tests. If you think this is a false positive, open an issue with a reproduction: https://github.com/vitest-dev/vitest/issues/new`;
@@ -27,7 +27,7 @@
27
27
  }
28
28
  </style>
29
29
  {__VITEST_INJECTOR__} {__VITEST_ERROR_CATCHER__} {__VITEST_SCRIPTS__}
30
- <script type="module" crossorigin src="/__vitest_browser__/orchestrator-Czo025Y6.js"></script>
30
+ <script type="module" crossorigin src="/__vitest_browser__/orchestrator-C2U7TVD1.js"></script>
31
31
  <link rel="modulepreload" crossorigin href="/__vitest_browser__/defineProperty-DgkPJYVE.js">
32
32
  </head>
33
33
  <body>
package/dist/index.js CHANGED
@@ -209,7 +209,7 @@ const basename = function(p, extension) {
209
209
  return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
210
210
  };
211
211
 
212
- var version = "5.0.4";
212
+ var version = "5.0.5";
213
213
 
214
214
  const pkgRoot = resolve(fileURLToPath(import.meta.url), "../..");
215
215
  const distRoot = resolve(pkgRoot, "dist");
@@ -2846,6 +2846,11 @@ function setupBrowserRpc(globalServer, defaultMockerRegistry) {
2846
2846
  }
2847
2847
  const sessions = vitest._browserSessions;
2848
2848
  if (!sessions.sessionIds.has(sessionId)) {
2849
+ if (sessions.closedSessionIds.has(sessionId)) {
2850
+ debug?.("[%s] ignoring the %s connection of a closed session", sessionId, type);
2851
+ socket.destroy();
2852
+ return;
2853
+ }
2849
2854
  const ids = [...sessions.sessionIds].join(", ");
2850
2855
  return error(new Error(`[vitest] Unknown session id "${sessionId}". Expected one of ${ids}.`));
2851
2856
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/browser",
3
3
  "type": "module",
4
- "version": "5.0.4",
4
+ "version": "5.0.5",
5
5
  "description": "Browser running for Vitest",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -63,13 +63,13 @@
63
63
  "providers"
64
64
  ],
65
65
  "peerDependencies": {
66
- "vitest": "5.0.4"
66
+ "vitest": "5.0.5"
67
67
  },
68
68
  "dependencies": {
69
69
  "@blazediff/core": "1.10.0",
70
- "@vitest/mocker": "5.0.4",
71
- "@vitest/ui": "5.0.4",
72
- "@vitest/utils": "5.0.4",
70
+ "@vitest/mocker": "5.0.5",
71
+ "@vitest/ui": "5.0.5",
72
+ "@vitest/utils": "5.0.5",
73
73
  "magic-string": "^1.4.3",
74
74
  "pngjs": "^7.0.0",
75
75
  "sirv": "^3.0.2",
@@ -82,7 +82,7 @@
82
82
  "@types/node": "24.19.2",
83
83
  "@types/pngjs": "^6.0.5",
84
84
  "@types/ws": "^8.18.2",
85
- "@vitest/snapshot": "5.0.4",
85
+ "@vitest/snapshot": "5.0.5",
86
86
  "birpc": "^4.2.0",
87
87
  "flatted": "^3.4.4",
88
88
  "ivya": "^1.8.2",
@@ -90,7 +90,7 @@
90
90
  "pathe": "^2.0.3",
91
91
  "rrweb-snapshot": "2.1.1",
92
92
  "vite": "8.0.11",
93
- "vitest": "5.0.4"
93
+ "vitest": "5.0.5"
94
94
  },
95
95
  "scripts": {
96
96
  "typecheck": "tsc -p ./src/client/tsconfig.json --noEmit",