@vitest/browser 3.0.3 → 3.0.4

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.
@@ -23,8 +23,8 @@
23
23
  })();
24
24
  </script>
25
25
  <!-- !LOAD_METADATA! -->
26
- <script type="module" src="./assets/index-D9z-wtyx.js"></script>
27
- <link rel="stylesheet" href="./assets/index-GEF0wBOB.css">
26
+ <script type="module" src="./assets/index-aqqnYS46.js"></script>
27
+ <link rel="stylesheet" href="./assets/index-DGgp9MUX.css">
28
28
  </head>
29
29
  <body>
30
30
  <div id="app"></div>
@@ -11835,7 +11835,7 @@ function normalizeWindowsPath(input = "") {
11835
11835
  const _UNC_REGEX = /^[/\\]{2}/;
11836
11836
  const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
11837
11837
  const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
11838
- const _EXTNAME_RE = /.(\.[^./]+)$/;
11838
+ const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
11839
11839
  const normalize = function(path) {
11840
11840
  if (path.length === 0) {
11841
11841
  return ".";
@@ -11950,6 +11950,7 @@ const isAbsolute = function(p) {
11950
11950
  return _IS_ABSOLUTE_RE.test(p);
11951
11951
  };
11952
11952
  const extname = function(p) {
11953
+ if (p === "..") return "";
11953
11954
  const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
11954
11955
  return match && match[1] || "";
11955
11956
  };
@@ -13479,7 +13480,7 @@ function parseSingleV8Stack(raw) {
13479
13480
  if (file.startsWith("file://")) {
13480
13481
  file = file.slice(7);
13481
13482
  }
13482
- file = resolve(file);
13483
+ file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve(file);
13483
13484
  if (method) {
13484
13485
  method = method.replace(/__vite_ssr_import_\d+__\./g, "");
13485
13486
  }
@@ -5,7 +5,7 @@
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-COSVU_mu.js"></script>
8
+ <script type="module" crossorigin src="/__vitest_browser__/tester-BbJOQDQr.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/__vitest_browser__/utils-Owv5OOOf.js">
10
10
  </head>
11
11
  <body>
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import { resolve as resolve$1, dirname as dirname$1, basename as basename$1, nor
16
16
  import { WebSocketServer } from 'ws';
17
17
  import * as nodeos from 'node:os';
18
18
 
19
- var version = "3.0.3";
19
+ var version = "3.0.4";
20
20
 
21
21
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
22
22
  function normalizeWindowsPath(input = "") {
@@ -30,7 +30,7 @@ const _UNC_REGEX = /^[/\\]{2}/;
30
30
  const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
31
31
  const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
32
32
  const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
33
- const _EXTNAME_RE = /.(\.[^./]+)$/;
33
+ const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
34
34
  const normalize = function(path) {
35
35
  if (path.length === 0) {
36
36
  return ".";
@@ -168,6 +168,7 @@ const isAbsolute = function(p) {
168
168
  return _IS_ABSOLUTE_RE.test(p);
169
169
  };
170
170
  const extname = function(p) {
171
+ if (p === "..") return "";
171
172
  const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
172
173
  return match && match[1] || "";
173
174
  };
@@ -654,7 +655,14 @@ var BrowserPlugin = (parentServer, base = "/") => {
654
655
  return;
655
656
  }
656
657
  const url = new URL(req.url, "http://localhost");
657
- const file = url.searchParams.get("file");
658
+ const id = url.searchParams.get("id");
659
+ if (!id) {
660
+ res.statusCode = 404;
661
+ res.end();
662
+ return;
663
+ }
664
+ const task = parentServer.vitest.state.idMap.get(id);
665
+ const file = task?.meta.failScreenshotPath;
658
666
  if (!file) {
659
667
  res.statusCode = 404;
660
668
  res.end();
@@ -1726,7 +1734,7 @@ var DOM_KEY_LOCATION = /*#__PURE__*/ function(DOM_KEY_LOCATION) {
1726
1734
  /**
1727
1735
  * Mapping for a default US-104-QWERTY keyboard
1728
1736
  */ const defaultKeyMap = [
1729
- // alphanumeric keys
1737
+ // alphanumeric block - writing system
1730
1738
  ...'0123456789'.split('').map((c)=>({
1731
1739
  code: `Digit${c}`,
1732
1740
  key: c
@@ -1745,6 +1753,24 @@ var DOM_KEY_LOCATION = /*#__PURE__*/ function(DOM_KEY_LOCATION) {
1745
1753
  key: c,
1746
1754
  shiftKey: true
1747
1755
  })),
1756
+ {
1757
+ code: 'BracketLeft',
1758
+ key: '['
1759
+ },
1760
+ {
1761
+ code: 'BracketLeft',
1762
+ key: '{',
1763
+ shiftKey: true
1764
+ },
1765
+ {
1766
+ code: 'BracketRight',
1767
+ key: ']'
1768
+ },
1769
+ {
1770
+ code: 'BracketRight',
1771
+ key: '}',
1772
+ shiftKey: true
1773
+ },
1748
1774
  // alphanumeric block - functional
1749
1775
  {
1750
1776
  code: 'Space',
@@ -1800,6 +1826,10 @@ var DOM_KEY_LOCATION = /*#__PURE__*/ function(DOM_KEY_LOCATION) {
1800
1826
  key: 'OS',
1801
1827
  location: DOM_KEY_LOCATION.RIGHT
1802
1828
  },
1829
+ {
1830
+ code: 'ContextMenu',
1831
+ key: 'ContextMenu'
1832
+ },
1803
1833
  {
1804
1834
  code: 'Tab',
1805
1835
  key: 'Tab'
@@ -1964,7 +1994,7 @@ function getErrorMessage(expected, found, text, context) {
1964
1994
  }
1965
1995
 
1966
1996
  /**
1967
- * Parse key defintions per `keyboardMap`
1997
+ * Parse key definitions per `keyboardMap`
1968
1998
  *
1969
1999
  * Keys can be referenced by `{key}` or `{special}` as well as physical locations per `[code]`.
1970
2000
  * Everything else will be interpreted as a typed character - e.g. `a`.
@@ -3080,6 +3110,9 @@ function createBrowserPool(vitest) {
3080
3110
  break;
3081
3111
  }
3082
3112
  await project._initBrowserProvider();
3113
+ if (!project.browser) {
3114
+ throw new TypeError(`The browser server was not initialized${project.name ? ` for the "${project.name}" project` : ""}. This is a bug in Vitest. Please, open a new issue with reproduction.`);
3115
+ }
3083
3116
  await executeTests(method, project, files);
3084
3117
  }
3085
3118
  };
package/jest-dom.d.ts CHANGED
@@ -260,8 +260,8 @@ declare namespace matchers {
260
260
  * @see
261
261
  * [testing-library/jest-dom#tohaveclass](https://github.com/testing-library/jest-dom#tohaveclass)
262
262
  */
263
- toHaveClass(...classNames: Array<string | RegExp>): R
264
263
  toHaveClass(classNames: string, options?: {exact: boolean}): R
264
+ toHaveClass(...classNames: Array<string | RegExp>): R
265
265
  /**
266
266
  * @description
267
267
  * This allows you to check whether the given form element has the specified displayed value (the one the
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/browser",
3
3
  "type": "module",
4
- "version": "3.0.3",
4
+ "version": "3.0.4",
5
5
  "description": "Browser running for Vitest",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -65,7 +65,7 @@
65
65
  "peerDependencies": {
66
66
  "playwright": "*",
67
67
  "webdriverio": "*",
68
- "vitest": "3.0.3"
68
+ "vitest": "3.0.4"
69
69
  },
70
70
  "peerDependenciesMeta": {
71
71
  "playwright": {
@@ -80,14 +80,14 @@
80
80
  },
81
81
  "dependencies": {
82
82
  "@testing-library/dom": "^10.4.0",
83
- "@testing-library/user-event": "^14.6.0",
83
+ "@testing-library/user-event": "^14.6.1",
84
84
  "magic-string": "^0.30.17",
85
85
  "msw": "^2.7.0",
86
86
  "sirv": "^3.0.0",
87
87
  "tinyrainbow": "^2.0.0",
88
88
  "ws": "^8.18.0",
89
- "@vitest/utils": "3.0.3",
90
- "@vitest/mocker": "3.0.3"
89
+ "@vitest/mocker": "3.0.4",
90
+ "@vitest/utils": "3.0.4"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@testing-library/jest-dom": "^6.6.3",
@@ -97,16 +97,16 @@
97
97
  "flatted": "^3.3.2",
98
98
  "ivya": "^1.1.1",
99
99
  "mime": "^4.0.6",
100
- "pathe": "^2.0.1",
100
+ "pathe": "^2.0.2",
101
101
  "periscopic": "^4.0.2",
102
102
  "playwright": "^1.49.1",
103
103
  "playwright-core": "^1.49.1",
104
104
  "safaridriver": "^1.0.0",
105
105
  "webdriverio": "^8.41.0",
106
- "@vitest/runner": "3.0.3",
107
- "@vitest/ws-client": "3.0.3",
108
- "@vitest/ui": "3.0.3",
109
- "vitest": "3.0.3"
106
+ "@vitest/runner": "3.0.4",
107
+ "vitest": "3.0.4",
108
+ "@vitest/ws-client": "3.0.4",
109
+ "@vitest/ui": "3.0.4"
110
110
  },
111
111
  "scripts": {
112
112
  "build": "rimraf dist && pnpm build:node && pnpm build:client",
package/utils.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // we cannot bundle it because vitest depend on the @vitest/browser and vise versa
3
3
  // fortunately, the file is quite small
4
4
 
5
- import { LocatorSelectors } from '@vitest/browser/context'
5
+ import { LocatorSelectors, Locator } from '@vitest/browser/context'
6
6
  import { StringifyOptions } from 'vitest/utils'
7
7
 
8
8
  export type PrettyDOMOptions = Omit<StringifyOptions, 'maxLength'>