@vitest/browser 4.1.0-beta.6 → 4.1.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.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ManualMockedModule, RedirectedModule, AutomockedModule, AutospiedModule, MockerRegistry } from '@vitest/mocker';
2
2
  import { dynamicImportPlugin, ServerMockResolver, interceptorPlugin } from '@vitest/mocker/node';
3
3
  import c from 'tinyrainbow';
4
- import { isValidApiRequest, isFileServingAllowed, distDir, resolveApiServerConfig, resolveFsAllow, rolldownVersion, isFileLoadingAllowed, createDebugger, createViteLogger, createViteServer } from 'vitest/node';
4
+ import { isValidApiRequest, isFileServingAllowed, distDir, rolldownVersion, resolveApiServerConfig, resolveFsAllow, isFileLoadingAllowed, createDebugger, createViteLogger, createViteServer } from 'vitest/node';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import fs, { readFileSync, createReadStream, promises, existsSync } from 'node:fs';
7
7
  import { createRequire } from 'node:module';
@@ -18,7 +18,7 @@ import { PNG } from 'pngjs';
18
18
  import { diff } from '@blazediff/core';
19
19
  import { WebSocketServer } from 'ws';
20
20
 
21
- var version = "4.1.0-beta.6";
21
+ var version = "4.1.1";
22
22
 
23
23
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
24
24
  function normalizeWindowsPath(input = "") {
@@ -236,8 +236,7 @@ const Primitives = (_, value) => (
236
236
  typeof value === primitive ? new Primitive(value) : value
237
237
  );
238
238
 
239
- const revive = (input, parsed, output, $) => {
240
- const lazy = [];
239
+ const resolver = (input, lazy, parsed, $) => output => {
241
240
  for (let ke = keys(output), {length} = ke, y = 0; y < length; y++) {
242
241
  const k = ke[y];
243
242
  const value = output[k];
@@ -246,7 +245,7 @@ const revive = (input, parsed, output, $) => {
246
245
  if (typeof tmp === object && !parsed.has(tmp)) {
247
246
  parsed.add(tmp);
248
247
  output[k] = ignore;
249
- lazy.push({k, a: [input, parsed, tmp, $]});
248
+ lazy.push({ o: output, k, r: tmp });
250
249
  }
251
250
  else
252
251
  output[k] = $.call(output, k, tmp);
@@ -254,10 +253,6 @@ const revive = (input, parsed, output, $) => {
254
253
  else if (output[k] !== ignore)
255
254
  output[k] = $.call(output, k, value);
256
255
  }
257
- for (let {length} = lazy, i = 0; i < length; i++) {
258
- const {k, a} = lazy[i];
259
- output[k] = $.call(output, k, revive.apply(null, a));
260
- }
261
256
  return output;
262
257
  };
263
258
 
@@ -275,12 +270,24 @@ const set = (known, input, value) => {
275
270
  */
276
271
  const parse = (text, reviver) => {
277
272
  const input = $parse(text, Primitives).map(primitives);
278
- const value = input[0];
279
273
  const $ = reviver || noop;
280
- const tmp = typeof value === object && value ?
281
- revive(input, new Set, value, $) :
282
- value;
283
- return $.call({'': tmp}, '', tmp);
274
+
275
+ let value = input[0];
276
+
277
+ if (typeof value === object && value) {
278
+ const lazy = [];
279
+ const revive = resolver(input, lazy, new Set, $);
280
+ value = revive(value);
281
+
282
+ let i = 0;
283
+ while (i < lazy.length) {
284
+ // it could be a lazy.shift() but that's costly
285
+ const {o, k, r} = lazy[i++];
286
+ o[k] = $.call(o, k, revive(r));
287
+ }
288
+ }
289
+
290
+ return $.call({'': value}, '', value);
284
291
  };
285
292
 
286
293
  /**
@@ -1154,7 +1161,7 @@ var BrowserPlugin = (parentServer, base = "/") => {
1154
1161
  },
1155
1162
  transform(code, id) {
1156
1163
  if (id.includes(parentServer.vite.config.cacheDir) && id.includes("loupe.js")) {
1157
- // loupe bundle has a nastry require('util') call that leaves a warning in the console
1164
+ // loupe bundle has a nasty require('util') call that leaves a warning in the console
1158
1165
  const utilRequire = "nodeUtil = require_util();";
1159
1166
  return code.replace(utilRequire, " ".repeat(utilRequire.length));
1160
1167
  }
@@ -1175,7 +1182,9 @@ var BrowserPlugin = (parentServer, base = "/") => {
1175
1182
  enforce: "post",
1176
1183
  async config(viteConfig) {
1177
1184
  // Enables using ignore hint for coverage providers with @preserve keyword
1178
- if (viteConfig.esbuild !== false) {
1185
+ // Only set esbuild options when not using rolldown-vite (Vite 8+),
1186
+ // which uses oxc for transformation instead of esbuild
1187
+ if (!rolldownVersion && viteConfig.esbuild !== false) {
1179
1188
  viteConfig.esbuild ||= {};
1180
1189
  viteConfig.esbuild.legalComments = "inline";
1181
1190
  }
@@ -2564,10 +2573,14 @@ class ProjectBrowser {
2564
2573
  }
2565
2574
  }
2566
2575
  function wrapConfig(config) {
2567
- return {
2568
- ...config,
2569
- testNamePattern: config.testNamePattern ? config.testNamePattern.toString() : undefined
2570
- };
2576
+ config = { ...config };
2577
+ // workaround RegExp serialization
2578
+ config.testNamePattern &&= config.testNamePattern.toString();
2579
+ // workaround RegExp serialization
2580
+ if (typeof config.retry === "object") {
2581
+ config.retry.condition &&= config.retry.condition.toString();
2582
+ }
2583
+ return config;
2571
2584
  }
2572
2585
 
2573
2586
  class ParentBrowserProject {
package/dist/locators.js CHANGED
@@ -1 +1 @@
1
- export{L as Locator,o as convertElementToCssSelector,q as ensureAwaited,r as getByAltTextSelector,s as getByLabelSelector,t as getByPlaceholderSelector,u as getByRoleSelector,v as getByTestIdSelector,w as getByTextSelector,x as getByTitleSelector,y as getIframeScale,p as processTimeoutOptions,z as selectorEngine,A as triggerCommandWithTrace}from"./index-CDbEr3te.js";import"vitest/browser";import"vitest/internal/browser";
1
+ export{L as Locator,o as convertElementToCssSelector,q as ensureAwaited,r as getByAltTextSelector,s as getByLabelSelector,t as getByPlaceholderSelector,u as getByRoleSelector,v as getByTestIdSelector,w as getByTextSelector,x as getByTitleSelector,y as getIframeScale,p as processTimeoutOptions,z as selectorEngine,A as triggerCommandWithTrace}from"./index-5Pe7X7sp.js";import"vitest/browser";import"vitest/internal/browser";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/browser",
3
3
  "type": "module",
4
- "version": "4.1.0-beta.6",
4
+ "version": "4.1.1",
5
5
  "description": "Browser running for Vitest",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -57,7 +57,7 @@
57
57
  "providers"
58
58
  ],
59
59
  "peerDependencies": {
60
- "vitest": "4.1.0-beta.6"
60
+ "vitest": "4.1.1"
61
61
  },
62
62
  "dependencies": {
63
63
  "@blazediff/core": "1.9.1",
@@ -66,8 +66,8 @@
66
66
  "sirv": "^3.0.2",
67
67
  "tinyrainbow": "^3.0.3",
68
68
  "ws": "^8.19.0",
69
- "@vitest/utils": "4.1.0-beta.6",
70
- "@vitest/mocker": "4.1.0-beta.6"
69
+ "@vitest/mocker": "4.1.1",
70
+ "@vitest/utils": "4.1.1"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@opentelemetry/api": "^1.9.0",
@@ -75,12 +75,12 @@
75
75
  "@types/pngjs": "^6.0.5",
76
76
  "@types/ws": "^8.18.1",
77
77
  "birpc": "^4.0.0",
78
- "flatted": "3.3.4",
78
+ "flatted": "3.4.0",
79
79
  "ivya": "^1.7.1",
80
80
  "mime": "^4.1.0",
81
81
  "pathe": "^2.0.3",
82
- "vitest": "4.1.0-beta.6",
83
- "@vitest/runner": "4.1.0-beta.6"
82
+ "vitest": "4.1.1",
83
+ "@vitest/runner": "4.1.1"
84
84
  },
85
85
  "scripts": {
86
86
  "typecheck": "tsc -p ./src/client/tsconfig.json --noEmit",