@vitest/browser 2.0.0-beta.1 → 2.0.0-beta.11
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 +244 -0
- package/context.js +2 -0
- package/dist/client/.vite/manifest.json +24 -0
- package/dist/client/__vitest__/assets/index-BfnqOMHY.js +51 -0
- package/dist/client/__vitest__/assets/index-qZYZB8Y3.css +1 -0
- package/dist/client/__vitest__/index.html +16 -11
- package/dist/client/__vitest_browser__/orchestrator-DQ4hbmZ_.js +338 -0
- package/dist/client/__vitest_browser__/{rpc-By4jD8av.js → rpc-D6HtJ5Rb.js} +310 -399
- package/dist/client/__vitest_browser__/tester-IF8AbWCS.js +837 -0
- package/dist/client/esm-client-injector.js +24 -37
- package/dist/client/{index.html → orchestrator.html} +8 -7
- package/dist/client/{tester.html → tester/tester.html} +13 -3
- package/dist/context.js +175 -0
- package/dist/index.d.ts +103 -4
- package/dist/index.js +1944 -332
- package/dist/providers.js +20 -116
- package/dist/state.js +1 -0
- package/dist/webdriver-BRud6NtS.js +180 -0
- package/package.json +23 -11
- package/providers/playwright.d.ts +36 -2
- package/providers/webdriverio.d.ts +4 -0
- package/providers.d.ts +5 -5
- package/dist/client/__vitest__/assets/index-BMbN3lBu.js +0 -51
- package/dist/client/__vitest__/assets/index-D0Wp7rbG.css +0 -1
- package/dist/client/__vitest_browser__/main-DmAU-Uff.js +0 -102
- package/dist/client/__vitest_browser__/tester-CrKhlp5g.js +0 -473
|
@@ -1,61 +1,48 @@
|
|
|
1
|
-
const moduleCache = new Map()
|
|
1
|
+
const moduleCache = new Map();
|
|
2
2
|
|
|
3
3
|
function wrapModule(module) {
|
|
4
|
-
if (module
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.finally(() =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (exports === sourceModule)
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
if (Object(sourceModule) !== sourceModule || Array.isArray(sourceModule))
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
for (const key in sourceModule) {
|
|
21
|
-
if (key !== 'default') {
|
|
22
|
-
try {
|
|
23
|
-
Object.defineProperty(exports, key, {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
get: () => sourceModule[key],
|
|
27
|
-
})
|
|
28
|
-
}
|
|
29
|
-
catch (_err) { }
|
|
30
|
-
}
|
|
4
|
+
if (typeof module === "function") {
|
|
5
|
+
const promise = new Promise((resolve, reject) => {
|
|
6
|
+
if (typeof __vitest_mocker__ === "undefined")
|
|
7
|
+
return module().then(resolve, reject);
|
|
8
|
+
__vitest_mocker__.prepare().finally(() => {
|
|
9
|
+
module().then(resolve, reject);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
moduleCache.set(promise, { promise, evaluated: false });
|
|
13
|
+
return promise.finally(() => moduleCache.delete(promise));
|
|
31
14
|
}
|
|
15
|
+
return module;
|
|
32
16
|
}
|
|
33
17
|
|
|
34
18
|
window.__vitest_browser_runner__ = {
|
|
35
|
-
exportAll,
|
|
36
19
|
wrapModule,
|
|
37
20
|
moduleCache,
|
|
38
21
|
config: { __VITEST_CONFIG__ },
|
|
22
|
+
viteConfig: { __VITEST_VITE_CONFIG__ },
|
|
39
23
|
files: { __VITEST_FILES__ },
|
|
40
|
-
}
|
|
24
|
+
type: { __VITEST_TYPE__ },
|
|
25
|
+
contextId: { __VITEST_CONTEXT_ID__ },
|
|
26
|
+
provider: { __VITEST_PROVIDER__ },
|
|
27
|
+
providedContext: { __VITEST_PROVIDED_CONTEXT__ },
|
|
28
|
+
};
|
|
41
29
|
|
|
42
|
-
const config = __vitest_browser_runner__.config
|
|
30
|
+
const config = __vitest_browser_runner__.config;
|
|
43
31
|
|
|
44
32
|
if (config.testNamePattern)
|
|
45
|
-
config.testNamePattern = parseRegexp(config.testNamePattern)
|
|
33
|
+
config.testNamePattern = parseRegexp(config.testNamePattern);
|
|
46
34
|
|
|
47
35
|
function parseRegexp(input) {
|
|
48
36
|
// Parse input
|
|
49
|
-
const m = input.match(/(\/?)(.+)\1([a-z]*)/i)
|
|
37
|
+
const m = input.match(/(\/?)(.+)\1([a-z]*)/i);
|
|
50
38
|
|
|
51
39
|
// match nothing
|
|
52
|
-
if (!m)
|
|
53
|
-
return /$^/
|
|
40
|
+
if (!m) return /$^/;
|
|
54
41
|
|
|
55
42
|
// Invalid flags
|
|
56
43
|
if (m[3] && !/^(?!.*?(.).*?\1)[gmixXsuUAJ]+$/.test(m[3]))
|
|
57
|
-
return RegExp(input)
|
|
44
|
+
return RegExp(input);
|
|
58
45
|
|
|
59
46
|
// Create the regular expression
|
|
60
|
-
return new RegExp(m[2], m[3])
|
|
47
|
+
return new RegExp(m[2], m[3]);
|
|
61
48
|
}
|
|
@@ -15,19 +15,20 @@
|
|
|
15
15
|
padding: 0;
|
|
16
16
|
margin: 0;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
html,
|
|
19
|
+
body,
|
|
20
|
+
iframe[data-vitest],
|
|
21
|
+
#vitest-tester {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
22
24
|
}
|
|
23
25
|
</style>
|
|
24
26
|
<script>{__VITEST_INJECTOR__}</script>
|
|
25
27
|
{__VITEST_SCRIPTS__}
|
|
26
|
-
<script type="module" crossorigin src="/__vitest_browser__/
|
|
27
|
-
<link rel="modulepreload" crossorigin href="/__vitest_browser__/rpc-
|
|
28
|
+
<script type="module" crossorigin src="/__vitest_browser__/orchestrator-DQ4hbmZ_.js"></script>
|
|
29
|
+
<link rel="modulepreload" crossorigin href="/__vitest_browser__/rpc-D6HtJ5Rb.js">
|
|
28
30
|
</head>
|
|
29
31
|
<body>
|
|
30
|
-
<iframe id="vitest-ui" src=""></iframe>
|
|
31
32
|
<div id="vitest-tester"></div>
|
|
32
33
|
</body>
|
|
33
34
|
</html>
|
|
@@ -13,14 +13,24 @@
|
|
|
13
13
|
body {
|
|
14
14
|
padding: 0;
|
|
15
15
|
margin: 0;
|
|
16
|
+
min-height: 100vh;
|
|
16
17
|
}
|
|
17
18
|
</style>
|
|
18
19
|
<script>{__VITEST_INJECTOR__}</script>
|
|
20
|
+
<script>{__VITEST_STATE__}</script>
|
|
19
21
|
{__VITEST_SCRIPTS__}
|
|
20
|
-
<script type="module" crossorigin src="/__vitest_browser__/tester-
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/__vitest_browser__/rpc-
|
|
22
|
+
<script type="module" crossorigin src="/__vitest_browser__/tester-IF8AbWCS.js"></script>
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/__vitest_browser__/rpc-D6HtJ5Rb.js">
|
|
22
24
|
</head>
|
|
23
|
-
<body
|
|
25
|
+
<body
|
|
26
|
+
data-vitest-body
|
|
27
|
+
style="
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
transform: scale(1);
|
|
31
|
+
transform-origin: left top;
|
|
32
|
+
"
|
|
33
|
+
>
|
|
24
34
|
{__VITEST_APPEND__}
|
|
25
35
|
</body>
|
|
26
36
|
</html>
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
function convertElementToXPath(element) {
|
|
2
|
+
if (!element || !(element instanceof Element)) {
|
|
3
|
+
throw new Error(
|
|
4
|
+
`Expected DOM element to be an instance of Element, received ${typeof element}`
|
|
5
|
+
);
|
|
6
|
+
}
|
|
7
|
+
return getPathTo(element);
|
|
8
|
+
}
|
|
9
|
+
function getPathTo(element) {
|
|
10
|
+
if (element.id !== "") {
|
|
11
|
+
return `id("${element.id}")`;
|
|
12
|
+
}
|
|
13
|
+
if (!element.parentNode || element === document.documentElement) {
|
|
14
|
+
return element.tagName;
|
|
15
|
+
}
|
|
16
|
+
let ix = 0;
|
|
17
|
+
const siblings = element.parentNode.childNodes;
|
|
18
|
+
for (let i = 0; i < siblings.length; i++) {
|
|
19
|
+
const sibling = siblings[i];
|
|
20
|
+
if (sibling === element) {
|
|
21
|
+
return `${getPathTo(element.parentNode)}/${element.tagName}[${ix + 1}]`;
|
|
22
|
+
}
|
|
23
|
+
if (sibling.nodeType === 1 && sibling.tagName === element.tagName) {
|
|
24
|
+
ix++;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return "invalid xpath";
|
|
28
|
+
}
|
|
29
|
+
const state = () => __vitest_worker__;
|
|
30
|
+
const runner = () => __vitest_browser_runner__;
|
|
31
|
+
function filepath() {
|
|
32
|
+
return state().filepath || state().current?.file?.filepath || void 0;
|
|
33
|
+
}
|
|
34
|
+
const rpc = () => state().rpc;
|
|
35
|
+
const contextId = runner().contextId;
|
|
36
|
+
const channel = new BroadcastChannel(`vitest:${contextId}`);
|
|
37
|
+
function triggerCommand(command, ...args) {
|
|
38
|
+
return rpc().triggerCommand(contextId, command, filepath(), args);
|
|
39
|
+
}
|
|
40
|
+
const provider = runner().provider;
|
|
41
|
+
const userEvent = {
|
|
42
|
+
// TODO: actually setup userEvent with config options
|
|
43
|
+
setup() {
|
|
44
|
+
return userEvent;
|
|
45
|
+
},
|
|
46
|
+
click(element, options = {}) {
|
|
47
|
+
const xpath = convertElementToXPath(element);
|
|
48
|
+
return triggerCommand("__vitest_click", xpath, options);
|
|
49
|
+
},
|
|
50
|
+
dblClick(element, options = {}) {
|
|
51
|
+
const xpath = convertElementToXPath(element);
|
|
52
|
+
return triggerCommand("__vitest_dblClick", xpath, options);
|
|
53
|
+
},
|
|
54
|
+
selectOptions(element, value) {
|
|
55
|
+
const values = provider === "webdriverio" ? getWebdriverioSelectOptions(element, value) : getSimpleSelectOptions(element, value);
|
|
56
|
+
return triggerCommand("__vitest_selectOptions", convertElementToXPath(element), values);
|
|
57
|
+
},
|
|
58
|
+
type(element, text, options = {}) {
|
|
59
|
+
const xpath = convertElementToXPath(element);
|
|
60
|
+
return triggerCommand("__vitest_type", xpath, text, options);
|
|
61
|
+
},
|
|
62
|
+
clear(element) {
|
|
63
|
+
const xpath = convertElementToXPath(element);
|
|
64
|
+
return triggerCommand("__vitest_clear", xpath);
|
|
65
|
+
},
|
|
66
|
+
tab(options = {}) {
|
|
67
|
+
return triggerCommand("__vitest_tab", options);
|
|
68
|
+
},
|
|
69
|
+
keyboard(text) {
|
|
70
|
+
return triggerCommand("__vitest_keyboard", text);
|
|
71
|
+
},
|
|
72
|
+
hover(element) {
|
|
73
|
+
const xpath = convertElementToXPath(element);
|
|
74
|
+
return triggerCommand("__vitest_hover", xpath);
|
|
75
|
+
},
|
|
76
|
+
unhover(element) {
|
|
77
|
+
const xpath = convertElementToXPath(element.ownerDocument.body);
|
|
78
|
+
return triggerCommand("__vitest_hover", xpath);
|
|
79
|
+
},
|
|
80
|
+
// non userEvent events, but still useful
|
|
81
|
+
fill(element, text, options) {
|
|
82
|
+
const xpath = convertElementToXPath(element);
|
|
83
|
+
return triggerCommand("__vitest_fill", xpath, text, options);
|
|
84
|
+
},
|
|
85
|
+
dragAndDrop(source, target, options = {}) {
|
|
86
|
+
const sourceXpath = convertElementToXPath(source);
|
|
87
|
+
const targetXpath = convertElementToXPath(target);
|
|
88
|
+
return triggerCommand("__vitest_dragAndDrop", sourceXpath, targetXpath, options);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
function getWebdriverioSelectOptions(element, value) {
|
|
92
|
+
const options = [...element.querySelectorAll("option")];
|
|
93
|
+
const arrayValues = Array.isArray(value) ? value : [value];
|
|
94
|
+
if (!arrayValues.length) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
if (arrayValues.length > 1) {
|
|
98
|
+
throw new Error(`Provider "webdriverio" doesn't support selecting multiple values at once`);
|
|
99
|
+
}
|
|
100
|
+
const optionValue = arrayValues[0];
|
|
101
|
+
if (typeof optionValue !== "string") {
|
|
102
|
+
const index = options.indexOf(optionValue);
|
|
103
|
+
if (index === -1) {
|
|
104
|
+
throw new Error(`The element ${convertElementToXPath(optionValue)} was not found in the "select" options.`);
|
|
105
|
+
}
|
|
106
|
+
return [{ index }];
|
|
107
|
+
}
|
|
108
|
+
const valueIndex = options.findIndex((option) => option.value === optionValue);
|
|
109
|
+
if (valueIndex !== -1) {
|
|
110
|
+
return [{ index: valueIndex }];
|
|
111
|
+
}
|
|
112
|
+
const labelIndex = options.findIndex(
|
|
113
|
+
(option) => option.textContent?.trim() === optionValue || option.ariaLabel === optionValue
|
|
114
|
+
);
|
|
115
|
+
if (labelIndex === -1) {
|
|
116
|
+
throw new Error(`The option "${optionValue}" was not found in the "select" options.`);
|
|
117
|
+
}
|
|
118
|
+
return [{ index: labelIndex }];
|
|
119
|
+
}
|
|
120
|
+
function getSimpleSelectOptions(element, value) {
|
|
121
|
+
return (Array.isArray(value) ? value : [value]).map((v) => {
|
|
122
|
+
if (typeof v !== "string") {
|
|
123
|
+
return { element: convertElementToXPath(v) };
|
|
124
|
+
}
|
|
125
|
+
return v;
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
const screenshotIds = {};
|
|
129
|
+
const page = {
|
|
130
|
+
get config() {
|
|
131
|
+
return runner().config;
|
|
132
|
+
},
|
|
133
|
+
viewport(width, height) {
|
|
134
|
+
const id = runner().iframeId;
|
|
135
|
+
channel.postMessage({ type: "viewport", width, height, id });
|
|
136
|
+
return new Promise((resolve, reject) => {
|
|
137
|
+
channel.addEventListener("message", function handler(e) {
|
|
138
|
+
if (e.data.type === "viewport:done" && e.data.id === id) {
|
|
139
|
+
channel.removeEventListener("message", handler);
|
|
140
|
+
resolve();
|
|
141
|
+
}
|
|
142
|
+
if (e.data.type === "viewport:fail" && e.data.id === id) {
|
|
143
|
+
channel.removeEventListener("message", handler);
|
|
144
|
+
reject(new Error(e.data.error));
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
async screenshot(options = {}) {
|
|
150
|
+
const currentTest = state().current;
|
|
151
|
+
if (!currentTest) {
|
|
152
|
+
throw new Error("Cannot take a screenshot outside of a test.");
|
|
153
|
+
}
|
|
154
|
+
if (currentTest.concurrent) {
|
|
155
|
+
throw new Error(
|
|
156
|
+
"Cannot take a screenshot in a concurrent test because concurrent tests run at the same time in the same iframe and affect each other's environment. Use a non-concurrent test to take a screenshot."
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
const repeatCount = currentTest.result?.repeatCount ?? 0;
|
|
160
|
+
const taskName = getTaskFullName(currentTest);
|
|
161
|
+
const number = screenshotIds[repeatCount]?.[taskName] ?? 1;
|
|
162
|
+
screenshotIds[repeatCount] ??= {};
|
|
163
|
+
screenshotIds[repeatCount][taskName] = number + 1;
|
|
164
|
+
const name = options.path || `${taskName.replace(/[^a-z0-9]/g, "-")}-${number}.png`;
|
|
165
|
+
return triggerCommand("__vitest_screenshot", name, {
|
|
166
|
+
...options,
|
|
167
|
+
element: options.element ? convertElementToXPath(options.element) : void 0
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
function getTaskFullName(task) {
|
|
172
|
+
return task.suite ? `${getTaskFullName(task.suite)} ${task.name}` : task.name;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export { page, userEvent };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,105 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BrowserServerState as BrowserServerState$1, BrowserServerStateContext, BrowserServer as BrowserServer$1, WorkspaceProject, Vite, BrowserProvider, BrowserScript, Vitest, ProcessPool } from 'vitest/node';
|
|
2
|
+
import { Plugin } from 'vitest/config';
|
|
3
|
+
import { File, TaskResultPack, AfterSuiteRunMeta, CancelReason, UserConsoleLog, SnapshotResult, ResolvedConfig } from 'vitest';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
|
|
6
|
+
type ReturnType<T> = T extends (...args: any) => infer R ? R : never;
|
|
7
|
+
type PromisifyFn<T> = ReturnType<T> extends Promise<any> ? T : (...args: ArgumentsType<T>) => Promise<Awaited<ReturnType<T>>>;
|
|
8
|
+
type BirpcFn<T> = PromisifyFn<T> & {
|
|
9
|
+
/**
|
|
10
|
+
* Send event without asking for response
|
|
11
|
+
*/
|
|
12
|
+
asEvent: (...args: ArgumentsType<T>) => void;
|
|
13
|
+
};
|
|
14
|
+
type BirpcReturn<RemoteFunctions, LocalFunctions = Record<string, never>> = {
|
|
15
|
+
[K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
|
|
16
|
+
} & {
|
|
17
|
+
$functions: LocalFunctions;
|
|
18
|
+
};
|
|
5
19
|
|
|
6
|
-
|
|
20
|
+
interface WebSocketBrowserHandlers {
|
|
21
|
+
resolveSnapshotPath: (testPath: string) => string;
|
|
22
|
+
resolveSnapshotRawPath: (testPath: string, rawPath: string) => string;
|
|
23
|
+
onUnhandledError: (error: unknown, type: string) => Promise<void>;
|
|
24
|
+
onCollected: (files?: File[]) => Promise<void>;
|
|
25
|
+
onTaskUpdate: (packs: TaskResultPack[]) => void;
|
|
26
|
+
onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
|
|
27
|
+
onCancel: (reason: CancelReason) => void;
|
|
28
|
+
getCountOfFailedTests: () => number;
|
|
29
|
+
readSnapshotFile: (id: string) => Promise<string | null>;
|
|
30
|
+
saveSnapshotFile: (id: string, content: string) => Promise<void>;
|
|
31
|
+
removeSnapshotFile: (id: string) => Promise<void>;
|
|
32
|
+
sendLog: (log: UserConsoleLog) => void;
|
|
33
|
+
finishBrowserTests: (contextId: string) => void;
|
|
34
|
+
snapshotSaved: (snapshot: SnapshotResult) => void;
|
|
35
|
+
debug: (...args: string[]) => void;
|
|
36
|
+
resolveId: (id: string, importer?: string) => Promise<{
|
|
37
|
+
id: string;
|
|
38
|
+
} | null>;
|
|
39
|
+
triggerCommand: <T>(contextId: string, command: string, testPath: string | undefined, payload: unknown[]) => Promise<T>;
|
|
40
|
+
resolveMock: (id: string, importer: string, hasFactory: boolean) => Promise<{
|
|
41
|
+
type: 'factory' | 'redirect' | 'automock';
|
|
42
|
+
mockPath?: string | null;
|
|
43
|
+
resolvedId: string;
|
|
44
|
+
}>;
|
|
45
|
+
invalidate: (ids: string[]) => void;
|
|
46
|
+
getBrowserFileSourceMap: (id: string) => SourceMap | null | {
|
|
47
|
+
mappings: '';
|
|
48
|
+
} | undefined;
|
|
49
|
+
}
|
|
50
|
+
interface WebSocketBrowserEvents {
|
|
51
|
+
onCancel: (reason: CancelReason) => void;
|
|
52
|
+
createTesters: (files: string[]) => Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
type WebSocketBrowserRPC = BirpcReturn<WebSocketBrowserEvents, WebSocketBrowserHandlers>;
|
|
55
|
+
interface SourceMap {
|
|
56
|
+
file: string;
|
|
57
|
+
mappings: string;
|
|
58
|
+
names: string[];
|
|
59
|
+
sources: string[];
|
|
60
|
+
sourcesContent?: string[];
|
|
61
|
+
version: number;
|
|
62
|
+
toString: () => string;
|
|
63
|
+
toUrl: () => string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
declare class BrowserServerState implements BrowserServerState$1 {
|
|
67
|
+
orchestrators: Map<string, WebSocketBrowserRPC>;
|
|
68
|
+
testers: Map<string, WebSocketBrowserRPC>;
|
|
69
|
+
private contexts;
|
|
70
|
+
getContext(contextId: string): BrowserServerStateContext | undefined;
|
|
71
|
+
createAsyncContext(contextId: string, files: string[]): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare class BrowserServer implements BrowserServer$1 {
|
|
75
|
+
project: WorkspaceProject;
|
|
76
|
+
base: string;
|
|
77
|
+
faviconUrl: string;
|
|
78
|
+
prefixTesterUrl: string;
|
|
79
|
+
orchestratorScripts: string | undefined;
|
|
80
|
+
testerScripts: string | undefined;
|
|
81
|
+
manifest: Promise<Vite.Manifest> | Vite.Manifest;
|
|
82
|
+
testerHtml: Promise<string> | string;
|
|
83
|
+
orchestratorHtml: Promise<string> | string;
|
|
84
|
+
injectorJs: Promise<string> | string;
|
|
85
|
+
stateJs: Promise<string> | string;
|
|
86
|
+
state: BrowserServerState;
|
|
87
|
+
provider: BrowserProvider;
|
|
88
|
+
vite: Vite.ViteDevServer;
|
|
89
|
+
constructor(project: WorkspaceProject, base: string);
|
|
90
|
+
setServer(server: Vite.ViteDevServer): void;
|
|
91
|
+
getSerializableConfig(): ResolvedConfig;
|
|
92
|
+
resolveTesterUrl(pathname: string): {
|
|
93
|
+
contextId: string;
|
|
94
|
+
testFile: string;
|
|
95
|
+
};
|
|
96
|
+
formatScripts(scripts: BrowserScript[] | undefined): Promise<string>;
|
|
97
|
+
initBrowserProvider(): Promise<void>;
|
|
98
|
+
close(): Promise<void>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare function createBrowserPool(ctx: Vitest): ProcessPool;
|
|
102
|
+
|
|
103
|
+
declare function createBrowserServer(project: WorkspaceProject, configFile: string | undefined, prePlugins?: Plugin[], postPlugins?: Plugin[]): Promise<BrowserServer>;
|
|
104
|
+
|
|
105
|
+
export { BrowserServer, createBrowserPool, createBrowserServer };
|