@vitest/browser 1.4.0 → 1.5.1

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.
@@ -1,4 +1,4 @@
1
- import { c as client, g as getConfig, a as getBrowserState, b as channel, r as rpcDone } from "./rpc-wczK3HEm.js";
1
+ import { c as client, g as getConfig, a as getBrowserState, b as channel, r as rpcDone } from "./rpc-slP7oy1q.js";
2
2
  const url = new URL(location.href);
3
3
  const ID_ALL = "__vitest_all__";
4
4
  const iframes = /* @__PURE__ */ new Map();
@@ -34,11 +34,15 @@ client.ws.addEventListener("open", async () => {
34
34
  }
35
35
  const runningFiles = new Set(testFiles);
36
36
  channel.addEventListener("message", async (e) => {
37
+ var _a;
37
38
  debug("channel event", JSON.stringify(e.data));
38
39
  switch (e.data.type) {
39
40
  case "done": {
40
41
  const filenames = e.data.filenames;
41
42
  filenames.forEach((filename) => runningFiles.delete(filename));
43
+ const iframeId = filenames.length > 1 ? ID_ALL : filenames[0];
44
+ (_a = iframes.get(iframeId)) == null ? void 0 : _a.remove();
45
+ iframes.delete(iframeId);
42
46
  if (!runningFiles.size)
43
47
  await done();
44
48
  break;
@@ -1,3 +1,9 @@
1
+ function __vite__mapDeps(indexes) {
2
+ if (!__vite__mapDeps.viteFileDeps) {
3
+ __vite__mapDeps.viteFileDeps = []
4
+ }
5
+ return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
6
+ }
1
7
  var __defProp = Object.defineProperty;
2
8
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
9
  var __publicField = (obj, key, value) => {
@@ -590,6 +596,8 @@ const __vitePreload = function preload(baseModule, deps, importerUrl) {
590
596
  let promise = Promise.resolve();
591
597
  if (deps && deps.length > 0) {
592
598
  const links = document.getElementsByTagName("link");
599
+ const cspNonceMeta = document.querySelector("meta[property=csp-nonce]");
600
+ const cspNonce = (cspNonceMeta == null ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta == null ? void 0 : cspNonceMeta.getAttribute("nonce"));
593
601
  promise = Promise.all(deps.map((dep) => {
594
602
  dep = assetsURL(dep);
595
603
  if (dep in seen)
@@ -615,6 +623,9 @@ const __vitePreload = function preload(baseModule, deps, importerUrl) {
615
623
  link.crossOrigin = "";
616
624
  }
617
625
  link.href = dep;
626
+ if (cspNonce) {
627
+ link.setAttribute("nonce", cspNonce);
628
+ }
618
629
  document.head.appendChild(link);
619
630
  if (isCss) {
620
631
  return new Promise((res, rej) => {
@@ -710,9 +721,3 @@ export {
710
721
  onCancel as o,
711
722
  rpcDone as r
712
723
  };
713
- function __vite__mapDeps(indexes) {
714
- if (!__vite__mapDeps.viteFileDeps) {
715
- __vite__mapDeps.viteFileDeps = []
716
- }
717
- return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
718
- }
@@ -1,10 +1,16 @@
1
+ function __vite__mapDeps(indexes) {
2
+ if (!__vite__mapDeps.viteFileDeps) {
3
+ __vite__mapDeps.viteFileDeps = []
4
+ }
5
+ return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
6
+ }
1
7
  var __defProp = Object.defineProperty;
2
8
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
9
  var __publicField = (obj, key, value) => {
4
10
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
11
  return value;
6
12
  };
7
- import { i as importId, d as rpc, g as getConfig, _ as __vitePreload, b as channel, a as getBrowserState, c as client, l as loadSafeRpc, o as onCancel } from "./rpc-wczK3HEm.js";
13
+ import { i as importId, d as rpc, g as getConfig, _ as __vitePreload, b as channel, a as getBrowserState, c as client, l as loadSafeRpc, o as onCancel } from "./rpc-slP7oy1q.js";
8
14
  function showPopupWarning(name, value, defaultValue) {
9
15
  return (...params) => {
10
16
  const formatedParams = params.map((p) => JSON.stringify(p)).join(", ");
@@ -458,9 +464,3 @@ async function runTests(files) {
458
464
  }
459
465
  }
460
466
  window.__vitest_browser_runner__.runTests = runTests;
461
- function __vite__mapDeps(indexes) {
462
- if (!__vite__mapDeps.viteFileDeps) {
463
- __vite__mapDeps.viteFileDeps = []
464
- }
465
- return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
466
- }
@@ -22,8 +22,8 @@
22
22
  }
23
23
  </style>
24
24
  <script>{__VITEST_INJECTOR__}</script>
25
- <script type="module" crossorigin src="/__vitest_browser__/main-c0_pDUlI.js"></script>
26
- <link rel="modulepreload" crossorigin href="/__vitest_browser__/rpc-wczK3HEm.js">
25
+ <script type="module" crossorigin src="/__vitest_browser__/main-v2hiOVax.js"></script>
26
+ <link rel="modulepreload" crossorigin href="/__vitest_browser__/rpc-slP7oy1q.js">
27
27
  </head>
28
28
  <body>
29
29
  <iframe id="vitest-ui" src=""></iframe>
@@ -16,8 +16,8 @@
16
16
  }
17
17
  </style>
18
18
  <script>{__VITEST_INJECTOR__}</script>
19
- <script type="module" crossorigin src="/__vitest_browser__/tester-__X2--mf.js"></script>
20
- <link rel="modulepreload" crossorigin href="/__vitest_browser__/rpc-wczK3HEm.js">
19
+ <script type="module" crossorigin src="/__vitest_browser__/tester-h3GciVI8.js"></script>
20
+ <link rel="modulepreload" crossorigin href="/__vitest_browser__/rpc-slP7oy1q.js">
21
21
  </head>
22
22
  <body>
23
23
  {__VITEST_APPEND__}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/browser",
3
3
  "type": "module",
4
- "version": "1.4.0",
4
+ "version": "1.5.1",
5
5
  "description": "Browser running for Vitest",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -43,7 +43,7 @@
43
43
  "peerDependencies": {
44
44
  "playwright": "*",
45
45
  "webdriverio": "*",
46
- "vitest": "1.4.0"
46
+ "vitest": "1.5.1"
47
47
  },
48
48
  "peerDependenciesMeta": {
49
49
  "playwright": {
@@ -59,7 +59,7 @@
59
59
  "dependencies": {
60
60
  "magic-string": "^0.30.5",
61
61
  "sirv": "^2.0.4",
62
- "@vitest/utils": "1.4.0"
62
+ "@vitest/utils": "1.5.1"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@types/ws": "^8.5.9",
@@ -69,10 +69,10 @@
69
69
  "playwright-core": "^1.41.0",
70
70
  "safaridriver": "^0.1.2",
71
71
  "webdriverio": "^8.32.2",
72
- "@vitest/runner": "1.4.0",
73
- "@vitest/ws-client": "1.4.0",
74
- "vitest": "1.4.0",
75
- "@vitest/ui": "1.4.0"
72
+ "@vitest/runner": "1.5.1",
73
+ "@vitest/ui": "1.5.1",
74
+ "@vitest/ws-client": "1.5.1",
75
+ "vitest": "1.5.1"
76
76
  },
77
77
  "scripts": {
78
78
  "build": "rimraf dist && pnpm build:node && pnpm build:client",