@vitest/browser 3.2.4 → 4.0.0-beta.2
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/client/.vite/manifest.json +2 -2
- package/dist/client/__vitest__/assets/{index-D_ryMEPs.js → index-Cil7RPEC.js} +34 -34
- package/dist/client/__vitest__/assets/{index-X8b7Z_4p.css → index-KbpJLW--.css} +1 -1
- package/dist/client/__vitest__/index.html +2 -2
- package/dist/client/__vitest_browser__/{orchestrator-Bo1OwGWc.js → orchestrator-CQgVbcQq.js} +1 -1
- package/dist/client/__vitest_browser__/{tester-BYDMHqQ9.js → tester-BScMoGFI.js} +7 -10
- package/dist/client/orchestrator.html +1 -1
- package/dist/client/tester/tester.html +1 -1
- package/dist/context.js +7 -4
- package/dist/index.d.ts +4 -5
- package/dist/index.js +4 -5
- package/dist/state.js +1 -0
- package/dist/types.d.ts +71 -0
- package/package.json +12 -10
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { MockedModuleSerialized, ServerIdResolution, ServerMockResolution } from "@vitest/mocker";
|
|
2
|
+
import type { TaskEventPack, TaskResultPack, TestAnnotation } from "@vitest/runner";
|
|
3
|
+
import type { BirpcReturn } from "birpc";
|
|
4
|
+
import type { AfterSuiteRunMeta, BrowserTesterOptions, CancelReason, RunnerTestFile, SerializedTestSpecification, SnapshotResult, TestExecutionMethod, UserConsoleLog } from "vitest";
|
|
5
|
+
export interface WebSocketBrowserHandlers {
|
|
6
|
+
resolveSnapshotPath: (testPath: string) => string;
|
|
7
|
+
resolveSnapshotRawPath: (testPath: string, rawPath: string) => string;
|
|
8
|
+
onUnhandledError: (error: unknown, type: string) => Promise<void>;
|
|
9
|
+
onQueued: (method: TestExecutionMethod, file: RunnerTestFile) => void;
|
|
10
|
+
onCollected: (method: TestExecutionMethod, files: RunnerTestFile[]) => Promise<void>;
|
|
11
|
+
onTaskAnnotate: (testId: string, annotation: TestAnnotation) => Promise<TestAnnotation>;
|
|
12
|
+
onTaskUpdate: (method: TestExecutionMethod, packs: TaskResultPack[], events: TaskEventPack[]) => void;
|
|
13
|
+
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
|
|
14
|
+
cancelCurrentRun: (reason: CancelReason) => void;
|
|
15
|
+
getCountOfFailedTests: () => number;
|
|
16
|
+
readSnapshotFile: (id: string) => Promise<string | null>;
|
|
17
|
+
saveSnapshotFile: (id: string, content: string) => Promise<void>;
|
|
18
|
+
removeSnapshotFile: (id: string) => Promise<void>;
|
|
19
|
+
sendLog: (method: TestExecutionMethod, log: UserConsoleLog) => void;
|
|
20
|
+
snapshotSaved: (snapshot: SnapshotResult) => void;
|
|
21
|
+
debug: (...args: string[]) => void;
|
|
22
|
+
resolveId: (id: string, importer?: string) => Promise<ServerIdResolution | null>;
|
|
23
|
+
triggerCommand: <T>(sessionId: string, command: string, testPath: string | undefined, payload: unknown[]) => Promise<T>;
|
|
24
|
+
resolveMock: (id: string, importer: string, options: {
|
|
25
|
+
mock: "spy" | "factory" | "auto"
|
|
26
|
+
}) => Promise<ServerMockResolution>;
|
|
27
|
+
invalidate: (ids: string[]) => void;
|
|
28
|
+
getBrowserFileSourceMap: (id: string) => SourceMap | null | {
|
|
29
|
+
mappings: ""
|
|
30
|
+
} | undefined;
|
|
31
|
+
wdioSwitchContext: (direction: "iframe" | "parent") => void;
|
|
32
|
+
registerMock: (sessionId: string, mock: MockedModuleSerialized) => void;
|
|
33
|
+
unregisterMock: (sessionId: string, id: string) => void;
|
|
34
|
+
clearMocks: (sessionId: string) => void;
|
|
35
|
+
// cdp
|
|
36
|
+
sendCdpEvent: (sessionId: string, event: string, payload?: Record<string, unknown>) => unknown;
|
|
37
|
+
trackCdpEvent: (sessionId: string, type: "on" | "once" | "off", event: string, listenerId: string) => void;
|
|
38
|
+
}
|
|
39
|
+
export type Awaitable<T> = T | PromiseLike<T>;
|
|
40
|
+
export interface WebSocketEvents {
|
|
41
|
+
onCollected?: (files: RunnerTestFile[]) => Awaitable<void>;
|
|
42
|
+
onFinished?: (files: File[], errors: unknown[], coverage?: unknown) => Awaitable<void>;
|
|
43
|
+
onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void>;
|
|
44
|
+
onUserConsoleLog?: (log: UserConsoleLog) => Awaitable<void>;
|
|
45
|
+
onPathsCollected?: (paths?: string[]) => Awaitable<void>;
|
|
46
|
+
onSpecsCollected?: (specs?: SerializedTestSpecification[]) => Awaitable<void>;
|
|
47
|
+
onFinishedReportCoverage: () => void;
|
|
48
|
+
}
|
|
49
|
+
export interface WebSocketBrowserEvents {
|
|
50
|
+
onCancel: (reason: CancelReason) => void;
|
|
51
|
+
createTesters: (options: BrowserTesterOptions) => Promise<void>;
|
|
52
|
+
cleanupTesters: () => Promise<void>;
|
|
53
|
+
cdpEvent: (event: string, payload: unknown) => void;
|
|
54
|
+
resolveManualMock: (url: string) => Promise<{
|
|
55
|
+
url: string
|
|
56
|
+
keys: string[]
|
|
57
|
+
responseId: string
|
|
58
|
+
}>;
|
|
59
|
+
}
|
|
60
|
+
export type WebSocketBrowserRPC = BirpcReturn<WebSocketBrowserEvents, WebSocketBrowserHandlers>;
|
|
61
|
+
interface SourceMap {
|
|
62
|
+
file: string;
|
|
63
|
+
mappings: string;
|
|
64
|
+
names: string[];
|
|
65
|
+
sources: string[];
|
|
66
|
+
sourcesContent?: string[];
|
|
67
|
+
version: number;
|
|
68
|
+
toString: () => string;
|
|
69
|
+
toUrl: () => string;
|
|
70
|
+
}
|
|
71
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/browser",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0-beta.2",
|
|
5
5
|
"description": "Browser running for Vitest",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"playwright": "*",
|
|
68
68
|
"webdriverio": "^7.0.0 || ^8.0.0 || ^9.0.0",
|
|
69
|
-
"vitest": "
|
|
69
|
+
"vitest": "4.0.0-beta.2"
|
|
70
70
|
},
|
|
71
71
|
"peerDependenciesMeta": {
|
|
72
72
|
"playwright": {
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"sirv": "^3.0.1",
|
|
87
87
|
"tinyrainbow": "^2.0.0",
|
|
88
88
|
"ws": "^8.18.2",
|
|
89
|
-
"@vitest/mocker": "
|
|
90
|
-
"@vitest/utils": "
|
|
89
|
+
"@vitest/mocker": "4.0.0-beta.2",
|
|
90
|
+
"@vitest/utils": "4.0.0-beta.2"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@types/ws": "^8.18.1",
|
|
@@ -99,16 +99,18 @@
|
|
|
99
99
|
"mime": "^4.0.7",
|
|
100
100
|
"pathe": "^2.0.3",
|
|
101
101
|
"periscopic": "^4.0.2",
|
|
102
|
-
"playwright": "^1.53.
|
|
103
|
-
"playwright-core": "^1.53.
|
|
102
|
+
"playwright": "^1.53.1",
|
|
103
|
+
"playwright-core": "^1.53.1",
|
|
104
104
|
"safaridriver": "^1.0.0",
|
|
105
105
|
"webdriverio": "^9.15.0",
|
|
106
|
-
"@vitest/
|
|
107
|
-
"@vitest/
|
|
108
|
-
"vitest": "
|
|
109
|
-
"
|
|
106
|
+
"@vitest/runner": "4.0.0-beta.2",
|
|
107
|
+
"@vitest/ui": "4.0.0-beta.2",
|
|
108
|
+
"@vitest/ws-client": "4.0.0-beta.2",
|
|
109
|
+
"vitest": "4.0.0-beta.2"
|
|
110
110
|
},
|
|
111
111
|
"scripts": {
|
|
112
|
+
"typecheck": "tsc -p ./src/client/tsconfig.json --noEmit",
|
|
113
|
+
"typecheck:why": "tsc -p ./src/client/tsconfig.json --noEmit --explainFiles > explainTypes.txt",
|
|
112
114
|
"build": "rimraf dist && pnpm build:node && pnpm build:client",
|
|
113
115
|
"build:client": "vite build src/client",
|
|
114
116
|
"build:node": "rollup -c",
|