@vitest/browser 4.1.0 → 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.
@@ -50,6 +50,9 @@
50
50
  if (config.testNamePattern)
51
51
  config.testNamePattern = parseRegexp(config.testNamePattern);
52
52
 
53
+ if (config.retry?.condition)
54
+ config.retry.condition = parseRegexp(config.retry.condition);
55
+
53
56
  function parseRegexp(input) {
54
57
  // Parse input
55
58
  const m = input.match(/(\/?)(.+)\1([a-z]*)/i);
@@ -26,8 +26,8 @@
26
26
  {__VITEST_INJECTOR__}
27
27
  {__VITEST_ERROR_CATCHER__}
28
28
  {__VITEST_SCRIPTS__}
29
- <script type="module" crossorigin src="/__vitest_browser__/orchestrator-CXs6qrFe.js"></script>
30
- <link rel="modulepreload" crossorigin href="/__vitest_browser__/utils-C2ISqq1C.js">
29
+ <script type="module" crossorigin src="/__vitest_browser__/orchestrator-DOndLT0I.js"></script>
30
+ <link rel="modulepreload" crossorigin href="/__vitest_browser__/utils-Dsu9dGGg.js">
31
31
  </head>
32
32
  <body>
33
33
  <div id="vitest-tester"></div>
@@ -5,8 +5,8 @@
5
5
  <link rel="icon" href="{__VITEST_FAVICON__}" type="image/svg+xml">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Vitest Browser Tester</title>
8
- <script type="module" crossorigin src="/__vitest_browser__/tester-K5NNxh1O.js"></script>
9
- <link rel="modulepreload" crossorigin href="/__vitest_browser__/utils-C2ISqq1C.js">
8
+ <script type="module" crossorigin src="/__vitest_browser__/tester-FJ31y3VC.js"></script>
9
+ <link rel="modulepreload" crossorigin href="/__vitest_browser__/utils-Dsu9dGGg.js">
10
10
  </head>
11
11
  <body>
12
12
  </body>
package/dist/context.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { vi } from 'vitest';
1
2
  import { __INTERNAL, stringify } from 'vitest/internal/browser';
2
3
 
3
4
  function ensureAwaited(promise) {
@@ -304,7 +305,10 @@ function createUserEvent(__tl_user_event_base__, options) {
304
305
  return userEvent;
305
306
  }
306
307
  function createPreviewUserEvent(userEventBase, options) {
307
- let userEvent = userEventBase.setup(options);
308
+ let userEvent = userEventBase.setup({
309
+ advanceTimers: (delay) => vi.advanceTimersByTimeAsync(delay),
310
+ ...options
311
+ });
308
312
  let clipboardData;
309
313
  function toElement(element) {
310
314
  return element instanceof Element ? element : element.element();
@@ -314,7 +318,10 @@ function createPreviewUserEvent(userEventBase, options) {
314
318
  return createPreviewUserEvent(userEventBase, options);
315
319
  },
316
320
  async cleanup() {
317
- userEvent = userEventBase.setup(options ?? {});
321
+ userEvent = userEventBase.setup({
322
+ advanceTimers: (delay) => vi.advanceTimersByTimeAsync(delay),
323
+ ...options
324
+ });
318
325
  },
319
326
  async click(element) {
320
327
  await userEvent.click(toElement(element));
package/dist/index.js CHANGED
@@ -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";
21
+ var version = "4.1.1";
22
22
 
23
23
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
24
24
  function normalizeWindowsPath(input = "") {
@@ -1161,7 +1161,7 @@ var BrowserPlugin = (parentServer, base = "/") => {
1161
1161
  },
1162
1162
  transform(code, id) {
1163
1163
  if (id.includes(parentServer.vite.config.cacheDir) && id.includes("loupe.js")) {
1164
- // 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
1165
1165
  const utilRequire = "nodeUtil = require_util();";
1166
1166
  return code.replace(utilRequire, " ".repeat(utilRequire.length));
1167
1167
  }
@@ -2573,10 +2573,14 @@ class ProjectBrowser {
2573
2573
  }
2574
2574
  }
2575
2575
  function wrapConfig(config) {
2576
- return {
2577
- ...config,
2578
- testNamePattern: config.testNamePattern ? config.testNamePattern.toString() : undefined
2579
- };
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;
2580
2584
  }
2581
2585
 
2582
2586
  class ParentBrowserProject {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/browser",
3
3
  "type": "module",
4
- "version": "4.1.0",
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"
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/mocker": "4.1.0",
70
- "@vitest/utils": "4.1.0"
69
+ "@vitest/mocker": "4.1.1",
70
+ "@vitest/utils": "4.1.1"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@opentelemetry/api": "^1.9.0",
@@ -79,8 +79,8 @@
79
79
  "ivya": "^1.7.1",
80
80
  "mime": "^4.1.0",
81
81
  "pathe": "^2.0.3",
82
- "vitest": "4.1.0",
83
- "@vitest/runner": "4.1.0"
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",