@vitest/browser 2.0.0-beta.10 → 2.0.0-beta.12
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 +133 -11
- package/context.js +2 -0
- package/dist/client/.vite/manifest.json +9 -9
- package/dist/client/__vitest__/assets/index-BcWipdNi.js +52 -0
- package/dist/client/__vitest__/assets/index-goqgbqVs.css +1 -0
- package/dist/client/__vitest__/index.html +16 -11
- package/dist/client/__vitest_browser__/{rpc-CImfI7bO.js → client-Dz5Ebwug.js} +93 -110
- package/dist/client/__vitest_browser__/orchestrator-DJ6H4qlM.js +371 -0
- package/dist/client/__vitest_browser__/tester-DHXll_4H.js +12164 -0
- package/dist/client/esm-client-injector.js +19 -18
- package/dist/client/orchestrator.html +2 -2
- package/dist/client/{tester.html → tester/tester.html} +12 -3
- package/dist/context.js +108 -17
- package/dist/index.d.ts +120 -5
- package/dist/index.js +1916 -276
- package/dist/providers.js +10 -6
- package/dist/state.js +1 -0
- package/dist/{webdriver-CXn0ag9T.js → webdriver-CJA71Bgl.js} +69 -12
- package/jest-dom.d.ts +816 -0
- package/matchers.d.ts +22 -0
- package/package.json +13 -7
- package/providers/playwright.d.ts +50 -4
- package/providers/webdriverio.d.ts +1 -0
- package/dist/client/__vitest__/assets/index-BMAciMM5.js +0 -51
- package/dist/client/__vitest__/assets/index-BcFb8Rbc.css +0 -1
- package/dist/client/__vitest_browser__/orchestrator-BCpOi5ot.js +0 -301
- package/dist/client/__vitest_browser__/tester-e70VCOgC.js +0 -780
package/matchers.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type jsdomMatchers from './jest-dom.js'
|
|
2
|
+
import type { Assertion } from 'vitest'
|
|
3
|
+
|
|
4
|
+
declare module 'vitest' {
|
|
5
|
+
interface JestAssertion<T = any> extends jsdomMatchers.default.TestingLibraryMatchers<void, T> {}
|
|
6
|
+
|
|
7
|
+
type Promisify<O> = {
|
|
8
|
+
[K in keyof O]: O[K] extends (...args: infer A) => infer R
|
|
9
|
+
? O extends R
|
|
10
|
+
? Promisify<O[K]>
|
|
11
|
+
: (...args: A) => Promise<R>
|
|
12
|
+
: O[K];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type PromisifyDomAssertion<T> = Promisify<Assertion<T>>
|
|
16
|
+
|
|
17
|
+
interface ExpectStatic {
|
|
18
|
+
element: <T extends Element>(element: T, options?: ExpectPollOptions) => PromisifyDomAssertion<Awaited<T>>
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export {}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/browser",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.12",
|
|
5
5
|
"description": "Browser running for Vitest",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
"types": "./context.d.ts",
|
|
29
29
|
"default": "./context.js"
|
|
30
30
|
},
|
|
31
|
+
"./matchers": {
|
|
32
|
+
"types": "./matchers.d.ts"
|
|
33
|
+
},
|
|
31
34
|
"./providers/webdriverio": {
|
|
32
35
|
"types": "./providers/webdriverio.d.ts"
|
|
33
36
|
},
|
|
@@ -41,13 +44,14 @@
|
|
|
41
44
|
"types": "./dist/index.d.ts",
|
|
42
45
|
"files": [
|
|
43
46
|
"*.d.ts",
|
|
47
|
+
"context.js",
|
|
44
48
|
"dist",
|
|
45
49
|
"providers"
|
|
46
50
|
],
|
|
47
51
|
"peerDependencies": {
|
|
48
52
|
"playwright": "*",
|
|
49
53
|
"webdriverio": "*",
|
|
50
|
-
"vitest": "2.0.0-beta.
|
|
54
|
+
"vitest": "2.0.0-beta.12"
|
|
51
55
|
},
|
|
52
56
|
"peerDependenciesMeta": {
|
|
53
57
|
"playwright": {
|
|
@@ -66,9 +70,11 @@
|
|
|
66
70
|
"magic-string": "^0.30.10",
|
|
67
71
|
"msw": "^2.3.1",
|
|
68
72
|
"sirv": "^2.0.4",
|
|
69
|
-
"
|
|
73
|
+
"ws": "^8.17.1",
|
|
74
|
+
"@vitest/utils": "2.0.0-beta.12"
|
|
70
75
|
},
|
|
71
76
|
"devDependencies": {
|
|
77
|
+
"@testing-library/jest-dom": "^6.4.6",
|
|
72
78
|
"@types/ws": "^8.5.10",
|
|
73
79
|
"@wdio/protocols": "^8.38.0",
|
|
74
80
|
"birpc": "0.2.17",
|
|
@@ -79,10 +85,10 @@
|
|
|
79
85
|
"playwright-core": "^1.44.1",
|
|
80
86
|
"safaridriver": "^0.1.2",
|
|
81
87
|
"webdriverio": "^8.38.2",
|
|
82
|
-
"@vitest/runner": "2.0.0-beta.
|
|
83
|
-
"@vitest/ui": "2.0.0-beta.
|
|
84
|
-
"@vitest/ws-client": "2.0.0-beta.
|
|
85
|
-
"vitest": "2.0.0-beta.
|
|
88
|
+
"@vitest/runner": "2.0.0-beta.12",
|
|
89
|
+
"@vitest/ui": "2.0.0-beta.12",
|
|
90
|
+
"@vitest/ws-client": "2.0.0-beta.12",
|
|
91
|
+
"vitest": "2.0.0-beta.12"
|
|
86
92
|
},
|
|
87
93
|
"scripts": {
|
|
88
94
|
"build": "rimraf dist && pnpm build:node && pnpm build:client",
|
|
@@ -1,20 +1,66 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
BrowserContext,
|
|
2
3
|
BrowserContextOptions,
|
|
4
|
+
Frame,
|
|
3
5
|
FrameLocator,
|
|
4
6
|
LaunchOptions,
|
|
5
|
-
Locator,
|
|
6
7
|
Page,
|
|
8
|
+
CDPSession
|
|
7
9
|
} from 'playwright'
|
|
10
|
+
import { Protocol } from 'playwright-core/types/protocol'
|
|
11
|
+
import '../matchers.js'
|
|
8
12
|
|
|
9
13
|
declare module 'vitest/node' {
|
|
10
14
|
interface BrowserProviderOptions {
|
|
11
15
|
launch?: LaunchOptions
|
|
12
|
-
context?: Omit<
|
|
16
|
+
context?: Omit<
|
|
17
|
+
BrowserContextOptions,
|
|
18
|
+
'ignoreHTTPSErrors' | 'serviceWorkers'
|
|
19
|
+
>
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
export interface BrowserCommandContext {
|
|
16
23
|
page: Page
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
frame(): Promise<Frame>
|
|
25
|
+
iframe: FrameLocator
|
|
26
|
+
context: BrowserContext
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type PWHoverOptions = Parameters<Page['hover']>[1]
|
|
31
|
+
type PWClickOptions = Parameters<Page['click']>[1]
|
|
32
|
+
type PWDoubleClickOptions = Parameters<Page['dblclick']>[1]
|
|
33
|
+
type PWFillOptions = Parameters<Page['fill']>[2]
|
|
34
|
+
type PWScreenshotOptions = Parameters<Page['screenshot']>[0]
|
|
35
|
+
type PWSelectOptions = Parameters<Page['selectOption']>[2]
|
|
36
|
+
type PWDragAndDropOptions = Parameters<Page['dragAndDrop']>[2]
|
|
37
|
+
|
|
38
|
+
declare module '@vitest/browser/context' {
|
|
39
|
+
export interface UserEventHoverOptions extends PWHoverOptions {}
|
|
40
|
+
export interface UserEventClickOptions extends PWClickOptions {}
|
|
41
|
+
export interface UserEventDoubleClickOptions extends PWDoubleClickOptions {}
|
|
42
|
+
export interface UserEventFillOptions extends PWFillOptions {}
|
|
43
|
+
export interface UserEventSelectOptions extends PWSelectOptions {}
|
|
44
|
+
export interface UserEventDragOptions extends UserEventDragAndDropOptions {}
|
|
45
|
+
|
|
46
|
+
export interface ScreenshotOptions extends PWScreenshotOptions {}
|
|
47
|
+
|
|
48
|
+
export interface CDPSession {
|
|
49
|
+
send<T extends keyof Protocol.CommandParameters>(
|
|
50
|
+
method: T,
|
|
51
|
+
params?: Protocol.CommandParameters[T]
|
|
52
|
+
): Promise<Protocol.CommandReturnValues[T]>
|
|
53
|
+
on<T extends keyof Protocol.Events>(
|
|
54
|
+
event: T,
|
|
55
|
+
listener: (payload: Protocol.Events[T]) => void
|
|
56
|
+
): this;
|
|
57
|
+
once<T extends keyof Protocol.Events>(
|
|
58
|
+
event: T,
|
|
59
|
+
listener: (payload: Protocol.Events[T]) => void
|
|
60
|
+
): this;
|
|
61
|
+
off<T extends keyof Protocol.Events>(
|
|
62
|
+
event: T,
|
|
63
|
+
listener: (payload: Protocol.Events[T]) => void
|
|
64
|
+
): this;
|
|
19
65
|
}
|
|
20
66
|
}
|