@vitest/browser 2.1.2 → 2.1.3
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/context.d.ts +1 -1
- package/dist/client/.vite/manifest.json +2 -2
- package/dist/client/__vitest_browser__/{orchestrator-N9hisloQ.js → orchestrator-BCPid0xo.js} +4 -1
- package/dist/client/__vitest_browser__/{tester-iPUw4msx.js → tester-DZCtFstH.js} +8 -3
- package/dist/client/orchestrator.html +1 -1
- package/dist/client/tester/tester.html +1 -1
- package/dist/index.js +9 -7
- package/matchers.d.ts +1 -1
- package/package.json +8 -8
package/context.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "preload-helper"
|
|
5
5
|
},
|
|
6
6
|
"orchestrator.html": {
|
|
7
|
-
"file": "__vitest_browser__/orchestrator-
|
|
7
|
+
"file": "__vitest_browser__/orchestrator-BCPid0xo.js",
|
|
8
8
|
"name": "orchestrator",
|
|
9
9
|
"src": "orchestrator.html",
|
|
10
10
|
"isEntry": true,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
]
|
|
14
14
|
},
|
|
15
15
|
"tester/tester.html": {
|
|
16
|
-
"file": "__vitest_browser__/tester-
|
|
16
|
+
"file": "__vitest_browser__/tester-DZCtFstH.js",
|
|
17
17
|
"name": "tester",
|
|
18
18
|
"src": "tester/tester.html",
|
|
19
19
|
"isEntry": true,
|
package/dist/client/__vitest_browser__/{orchestrator-N9hisloQ.js → orchestrator-BCPid0xo.js}
RENAMED
|
@@ -834,7 +834,10 @@ function createModuleMockerInterceptor() {
|
|
|
834
834
|
globalThisAccessor: '"__vitest_mocker__"',
|
|
835
835
|
mswOptions: {
|
|
836
836
|
serviceWorker: {
|
|
837
|
-
url: "/
|
|
837
|
+
url: "/mockServiceWorker.js",
|
|
838
|
+
options: {
|
|
839
|
+
scope: "/"
|
|
840
|
+
}
|
|
838
841
|
},
|
|
839
842
|
quiet: true
|
|
840
843
|
}
|
|
@@ -7,7 +7,7 @@ import { page } from "@vitest/browser/context";
|
|
|
7
7
|
import { globalChannel, channel, client, onCancel, waitForChannel } from "@vitest/browser/client";
|
|
8
8
|
import { getSafeTimers, stringify, format, TraceMap, originalPositionFor } from "vitest/utils";
|
|
9
9
|
import { VitestTestRunner, NodeBenchmarkRunner } from "vitest/runners";
|
|
10
|
-
import { expect } from "vitest";
|
|
10
|
+
import { expect, chai } from "vitest";
|
|
11
11
|
function mockObject(options, object, mockExports = {}) {
|
|
12
12
|
const finalizers = new Array();
|
|
13
13
|
const refs = new RefTracker();
|
|
@@ -12052,10 +12052,15 @@ async function setupExpectDom() {
|
|
|
12052
12052
|
if (!(elementOrLocator instanceof Element) && !("element" in elementOrLocator)) {
|
|
12053
12053
|
throw new Error(`Invalid element or locator: ${elementOrLocator}. Expected an instance of Element or Locator, received ${typeof elementOrLocator}`);
|
|
12054
12054
|
}
|
|
12055
|
-
return expect.poll(()
|
|
12056
|
-
if (elementOrLocator instanceof Element) {
|
|
12055
|
+
return expect.poll(function element() {
|
|
12056
|
+
if (elementOrLocator instanceof Element || elementOrLocator == null) {
|
|
12057
12057
|
return elementOrLocator;
|
|
12058
12058
|
}
|
|
12059
|
+
const isNot = chai.util.flag(this, "negate");
|
|
12060
|
+
const name = chai.util.flag(this, "_name");
|
|
12061
|
+
if (isNot && name === "toBeInTheDocument") {
|
|
12062
|
+
return elementOrLocator.query();
|
|
12063
|
+
}
|
|
12059
12064
|
return elementOrLocator.element();
|
|
12060
12065
|
}, options);
|
|
12061
12066
|
};
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
{__VITEST_INJECTOR__}
|
|
27
27
|
{__VITEST_ERROR_CATCHER__}
|
|
28
28
|
{__VITEST_SCRIPTS__}
|
|
29
|
-
<script type="module" crossorigin src="/__vitest_browser__/orchestrator-
|
|
29
|
+
<script type="module" crossorigin src="/__vitest_browser__/orchestrator-BCPid0xo.js"></script>
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/__vitest_browser__/preload-helper-D-WYp1PK.js">
|
|
31
31
|
</head>
|
|
32
32
|
<body>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<script>{__VITEST_STATE__}</script>
|
|
21
21
|
{__VITEST_INTERNAL_SCRIPTS__}
|
|
22
22
|
{__VITEST_SCRIPTS__}
|
|
23
|
-
<script type="module" crossorigin src="/__vitest_browser__/tester-
|
|
23
|
+
<script type="module" crossorigin src="/__vitest_browser__/tester-DZCtFstH.js"></script>
|
|
24
24
|
<link rel="modulepreload" crossorigin href="/__vitest_browser__/preload-helper-D-WYp1PK.js">
|
|
25
25
|
</head>
|
|
26
26
|
<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 crypto from 'node:crypto';
|
|
17
17
|
import * as nodeos from 'node:os';
|
|
18
18
|
|
|
19
|
-
var version = "2.1.
|
|
19
|
+
var version = "2.1.3";
|
|
20
20
|
|
|
21
21
|
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
22
22
|
function normalizeWindowsPath(input = "") {
|
|
@@ -2201,7 +2201,7 @@ var BrowserPlugin = (browserServer, base = "/") => {
|
|
|
2201
2201
|
{
|
|
2202
2202
|
name: "vitest:browser:resolve-virtual",
|
|
2203
2203
|
async resolveId(rawId) {
|
|
2204
|
-
if (rawId === "/
|
|
2204
|
+
if (rawId === "/mockServiceWorker.js") {
|
|
2205
2205
|
return this.resolve("msw/mockServiceWorker.js", distRoot, {
|
|
2206
2206
|
skipSelf: true
|
|
2207
2207
|
});
|
|
@@ -2237,18 +2237,20 @@ var BrowserPlugin = (browserServer, base = "/") => {
|
|
|
2237
2237
|
enforce: "post",
|
|
2238
2238
|
async config(viteConfig) {
|
|
2239
2239
|
// Enables using ignore hint for coverage providers with @preserve keyword
|
|
2240
|
-
viteConfig.esbuild
|
|
2241
|
-
|
|
2242
|
-
|
|
2240
|
+
if (viteConfig.esbuild !== false) {
|
|
2241
|
+
viteConfig.esbuild ||= {};
|
|
2242
|
+
viteConfig.esbuild.legalComments = "inline";
|
|
2243
|
+
}
|
|
2244
|
+
const api = resolveApiServerConfig(
|
|
2243
2245
|
viteConfig.test?.browser || {},
|
|
2244
2246
|
defaultBrowserPort
|
|
2245
2247
|
) || {
|
|
2246
2248
|
port: defaultBrowserPort
|
|
2247
2249
|
};
|
|
2248
|
-
server.middlewareMode = false;
|
|
2249
2250
|
viteConfig.server = {
|
|
2250
2251
|
...viteConfig.server,
|
|
2251
|
-
...
|
|
2252
|
+
...api,
|
|
2253
|
+
middlewareMode: false,
|
|
2252
2254
|
open: false
|
|
2253
2255
|
};
|
|
2254
2256
|
viteConfig.server.fs ??= {};
|
package/matchers.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare module 'vitest' {
|
|
|
16
16
|
type PromisifyDomAssertion<T> = Promisify<Assertion<T>>
|
|
17
17
|
|
|
18
18
|
interface ExpectStatic {
|
|
19
|
-
element: <T extends Element | Locator>(element: T, options?: ExpectPollOptions) => PromisifyDomAssertion<Awaited<Element>>
|
|
19
|
+
element: <T extends Element | Locator>(element: T, options?: ExpectPollOptions) => PromisifyDomAssertion<Awaited<Element | null>>
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/browser",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.3",
|
|
5
5
|
"description": "Browser running for Vitest",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"playwright": "*",
|
|
64
64
|
"webdriverio": "*",
|
|
65
|
-
"vitest": "2.1.
|
|
65
|
+
"vitest": "2.1.3"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
|
68
68
|
"playwright": {
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"sirv": "^2.0.4",
|
|
84
84
|
"tinyrainbow": "^1.2.0",
|
|
85
85
|
"ws": "^8.18.0",
|
|
86
|
-
"@vitest/mocker": "2.1.
|
|
87
|
-
"@vitest/utils": "2.1.
|
|
86
|
+
"@vitest/mocker": "2.1.3",
|
|
87
|
+
"@vitest/utils": "2.1.3"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@testing-library/jest-dom": "^6.4.8",
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
"playwright-core": "^1.46.0",
|
|
101
101
|
"safaridriver": "^0.1.2",
|
|
102
102
|
"webdriverio": "^8.40.2",
|
|
103
|
-
"@vitest/runner": "2.1.
|
|
104
|
-
"@vitest/ui": "2.1.
|
|
105
|
-
"@vitest/ws-client": "2.1.
|
|
106
|
-
"vitest": "2.1.
|
|
103
|
+
"@vitest/runner": "2.1.3",
|
|
104
|
+
"@vitest/ui": "2.1.3",
|
|
105
|
+
"@vitest/ws-client": "2.1.3",
|
|
106
|
+
"vitest": "2.1.3"
|
|
107
107
|
},
|
|
108
108
|
"scripts": {
|
|
109
109
|
"build": "rimraf dist && pnpm build:node && pnpm build:client",
|