@rstest/browser 0.9.4 → 0.9.5
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/browser-container/container-static/js/{927.514b181bd2.js → 677.d1243053e0.js} +1205 -1211
- package/dist/browser-container/container-static/js/677.d1243053e0.js.LICENSE.txt +1 -0
- package/dist/browser-container/container-static/js/{index.5acf502b10.js → index.cb4870ffcc.js} +7 -7
- package/dist/browser-container/index.html +1 -1
- package/dist/client/dispatchTransport.d.ts +0 -1
- package/dist/client/sourceMapSupport.d.ts +2 -5
- package/dist/concurrency.d.ts +2 -2
- package/dist/dispatchCapabilities.d.ts +1 -1
- package/dist/headedSerialTaskQueue.d.ts +2 -1
- package/dist/headlessLatestRerunScheduler.d.ts +1 -1
- package/dist/hostController.d.ts +2 -1
- package/dist/index.js +251 -26
- package/dist/protocol.d.ts +1 -5
- package/dist/rpcProtocol.d.ts +0 -13
- package/dist/sessionRegistry.d.ts +1 -1
- package/dist/watchRerunPlanner.d.ts +2 -2
- package/package.json +17 -18
- package/src/client/dispatchTransport.ts +1 -1
- package/src/client/sourceMapSupport.ts +1 -9
- package/src/concurrency.ts +2 -2
- package/src/configValidation.ts +7 -1
- package/src/dispatchCapabilities.ts +1 -1
- package/src/headedSerialTaskQueue.ts +1 -1
- package/src/headlessLatestRerunScheduler.ts +1 -1
- package/src/hostController.ts +23 -10
- package/src/protocol.ts +0 -9
- package/src/rpcProtocol.ts +0 -15
- package/src/sessionRegistry.ts +1 -1
- package/src/watchCliShortcuts.ts +3 -1
- package/src/watchRerunPlanner.ts +2 -2
- package/dist/browser-container/container-static/js/927.514b181bd2.js.LICENSE.txt +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstest/browser",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"description": "Browser mode support for Rstest testing framework.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"rstest",
|
|
7
|
+
"browser",
|
|
8
|
+
"test",
|
|
9
|
+
"rstack",
|
|
10
|
+
"rspack"
|
|
11
|
+
],
|
|
5
12
|
"bugs": {
|
|
6
13
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
7
14
|
},
|
|
@@ -10,16 +17,8 @@
|
|
|
10
17
|
"url": "https://github.com/web-infra-dev/rstest",
|
|
11
18
|
"directory": "packages/browser"
|
|
12
19
|
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
"rstest",
|
|
15
|
-
"browser",
|
|
16
|
-
"test",
|
|
17
|
-
"rstack",
|
|
18
|
-
"rspack"
|
|
19
|
-
],
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"type": "module",
|
|
22
|
-
"main": "./dist/index.js",
|
|
23
22
|
"exports": {
|
|
24
23
|
".": {
|
|
25
24
|
"types": "./dist/browser.d.ts",
|
|
@@ -33,6 +32,7 @@
|
|
|
33
32
|
"default": "./package.json"
|
|
34
33
|
}
|
|
35
34
|
},
|
|
35
|
+
"main": "./dist/index.js",
|
|
36
36
|
"files": [
|
|
37
37
|
"dist",
|
|
38
38
|
"src",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"open-editor": "^6.0.0",
|
|
46
46
|
"pathe": "^2.0.3",
|
|
47
47
|
"sirv": "^3.0.2",
|
|
48
|
-
"ws": "^8.
|
|
48
|
+
"ws": "^8.20.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@rslib/core": "0.20.0",
|
|
@@ -55,16 +55,15 @@
|
|
|
55
55
|
"@typescript/native-preview": "7.0.0-dev.20260317.1",
|
|
56
56
|
"@vitest/snapshot": "^3.2.4",
|
|
57
57
|
"birpc": "^4.0.0",
|
|
58
|
-
"
|
|
59
|
-
"picomatch": "^4.0.3",
|
|
58
|
+
"picomatch": "^4.0.4",
|
|
60
59
|
"playwright": "^1.58.2",
|
|
61
|
-
"@rstest/
|
|
62
|
-
"@rstest/
|
|
63
|
-
"@rstest/
|
|
60
|
+
"@rstest/core": "0.9.5",
|
|
61
|
+
"@rstest/browser-ui": "0.0.0",
|
|
62
|
+
"@rstest/tsconfig": "0.0.1"
|
|
64
63
|
},
|
|
65
64
|
"peerDependencies": {
|
|
66
65
|
"playwright": "^1.49.1",
|
|
67
|
-
"@rstest/core": "^0.9.
|
|
66
|
+
"@rstest/core": "^0.9.5"
|
|
68
67
|
},
|
|
69
68
|
"peerDependenciesMeta": {
|
|
70
69
|
"playwright": {
|
|
@@ -80,7 +79,7 @@
|
|
|
80
79
|
},
|
|
81
80
|
"scripts": {
|
|
82
81
|
"build": "rslib build",
|
|
83
|
-
"
|
|
84
|
-
"
|
|
82
|
+
"dev": "rslib build --watch",
|
|
83
|
+
"typecheck": "tsc --noEmit"
|
|
85
84
|
}
|
|
86
85
|
}
|
|
@@ -111,18 +111,10 @@ export const preloadRunnerSourceMap = async (): Promise<void> => {
|
|
|
111
111
|
await preloadSourceMap(runnerUrl);
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
-
/**
|
|
115
|
-
* Clear cache (for testing purposes)
|
|
116
|
-
*/
|
|
117
|
-
export const clearCache = (): void => {
|
|
118
|
-
sourceMapCache.clear();
|
|
119
|
-
sourceMapPayloadCache.clear();
|
|
120
|
-
};
|
|
121
|
-
|
|
122
114
|
/**
|
|
123
115
|
* Stack frame interface matching @vitest/snapshot's format
|
|
124
116
|
*/
|
|
125
|
-
|
|
117
|
+
interface StackFrame {
|
|
126
118
|
file: string;
|
|
127
119
|
line: number;
|
|
128
120
|
column: number;
|
package/src/concurrency.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { Rstest } from '@rstest/core/browser';
|
|
|
5
5
|
// Keep this in one place so executors reuse the same worker semantics.
|
|
6
6
|
const DEFAULT_MAX_HEADLESS_WORKERS = 12;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
type HeadlessConcurrencyContext = Pick<Rstest, 'command'> & {
|
|
9
9
|
normalizedConfig: {
|
|
10
10
|
pool: {
|
|
11
11
|
maxWorkers?: string | number;
|
|
@@ -13,7 +13,7 @@ export type HeadlessConcurrencyContext = Pick<Rstest, 'command'> & {
|
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const getNumCpus = (): number => {
|
|
17
17
|
return os.availableParallelism?.() ?? os.cpus().length;
|
|
18
18
|
};
|
|
19
19
|
|
package/src/configValidation.ts
CHANGED
|
@@ -44,7 +44,7 @@ const validateViewport = (viewport: unknown): void => {
|
|
|
44
44
|
|
|
45
45
|
export const validateBrowserConfig = (context: Rstest): void => {
|
|
46
46
|
for (const project of context.projects) {
|
|
47
|
-
const browser = project.normalizedConfig
|
|
47
|
+
const { browser, output } = project.normalizedConfig;
|
|
48
48
|
if (!browser.enabled) {
|
|
49
49
|
continue;
|
|
50
50
|
}
|
|
@@ -66,5 +66,11 @@ export const validateBrowserConfig = (context: Rstest): void => {
|
|
|
66
66
|
if (!isPlainObject(browser.providerOptions)) {
|
|
67
67
|
throw new Error('browser.providerOptions must be a plain object.');
|
|
68
68
|
}
|
|
69
|
+
|
|
70
|
+
if (output?.bundleDependencies === false) {
|
|
71
|
+
throw new Error(
|
|
72
|
+
'output.bundleDependencies false is not supported in browser mode.',
|
|
73
|
+
);
|
|
74
|
+
}
|
|
69
75
|
}
|
|
70
76
|
};
|
|
@@ -27,7 +27,7 @@ type RunnerDispatchSuiteStartPayload = ReporterHookArg<'onTestSuiteStart'>;
|
|
|
27
27
|
type RunnerDispatchSuiteResultPayload = ReporterHookArg<'onTestSuiteResult'>;
|
|
28
28
|
type RunnerDispatchCaseStartPayload = ReporterHookArg<'onTestCaseStart'>;
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
type RunnerDispatchCallbacks = {
|
|
31
31
|
onTestFileStart: (payload: RunnerPayload<'file-start'>) => Promise<void>;
|
|
32
32
|
onTestFileReady: (payload: RunnerDispatchFileReadyPayload) => Promise<void>;
|
|
33
33
|
onTestSuiteStart: (payload: RunnerDispatchSuiteStartPayload) => Promise<void>;
|
package/src/hostController.ts
CHANGED
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
type RuntimeConfig,
|
|
23
23
|
rsbuild,
|
|
24
24
|
serializableConfig,
|
|
25
|
-
TEMP_RSTEST_OUTPUT_DIR,
|
|
26
25
|
type Test,
|
|
27
26
|
type TestFileResult,
|
|
28
27
|
type TestResult,
|
|
@@ -543,11 +542,12 @@ export const createBrowserLazyCompilationConfig = (
|
|
|
543
542
|
};
|
|
544
543
|
};
|
|
545
544
|
|
|
546
|
-
export const createBrowserRsbuildDevConfig = (
|
|
545
|
+
export const createBrowserRsbuildDevConfig = (_isWatchMode: boolean) => {
|
|
547
546
|
return {
|
|
548
|
-
|
|
549
|
-
//
|
|
550
|
-
|
|
547
|
+
writeToDisk: isDebug(),
|
|
548
|
+
// Keep HMR enabled in browser mode even for one-shot runs.
|
|
549
|
+
// lazyCompilation depends on HMR runtime wiring for async import chains.
|
|
550
|
+
hmr: true,
|
|
551
551
|
client: {
|
|
552
552
|
logLevel: 'error' as const,
|
|
553
553
|
},
|
|
@@ -1389,6 +1389,18 @@ const createBrowserRuntime = async ({
|
|
|
1389
1389
|
getPortSilently: true,
|
|
1390
1390
|
});
|
|
1391
1391
|
|
|
1392
|
+
if (isDebug()) {
|
|
1393
|
+
await rsbuildInstance.inspectConfig({
|
|
1394
|
+
writeToDisk: true,
|
|
1395
|
+
extraConfigs: {
|
|
1396
|
+
rstest: {
|
|
1397
|
+
...context.normalizedConfig,
|
|
1398
|
+
projects: browserProjects.map((p) => p.normalizedConfig),
|
|
1399
|
+
},
|
|
1400
|
+
},
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1392
1404
|
// Serve prebuilt container assets (SPA) via sirv
|
|
1393
1405
|
const serveContainer = containerDistPath
|
|
1394
1406
|
? sirv(containerDistPath, {
|
|
@@ -1574,10 +1586,10 @@ const createBrowserRuntime = async ({
|
|
|
1574
1586
|
dispatchHandlers,
|
|
1575
1587
|
wss,
|
|
1576
1588
|
};
|
|
1577
|
-
} catch (
|
|
1589
|
+
} catch (error) {
|
|
1578
1590
|
wss.close();
|
|
1579
1591
|
await devServer.close();
|
|
1580
|
-
throw
|
|
1592
|
+
throw error;
|
|
1581
1593
|
}
|
|
1582
1594
|
};
|
|
1583
1595
|
|
|
@@ -1831,14 +1843,15 @@ export const runBrowserController = async (
|
|
|
1831
1843
|
|
|
1832
1844
|
const isWatchMode = context.command === 'watch';
|
|
1833
1845
|
const enableCliShortcuts = isWatchMode && isBrowserWatchCliShortcutsEnabled();
|
|
1846
|
+
const browserTempOutputRoot = context.normalizedConfig.output.distPath.root;
|
|
1834
1847
|
const tempDir =
|
|
1835
1848
|
isWatchMode && watchContext.runtime
|
|
1836
1849
|
? watchContext.runtime.tempDir
|
|
1837
1850
|
: isWatchMode
|
|
1838
|
-
? join(context.rootPath,
|
|
1851
|
+
? join(context.rootPath, browserTempOutputRoot, 'browser', 'watch')
|
|
1839
1852
|
: join(
|
|
1840
1853
|
context.rootPath,
|
|
1841
|
-
|
|
1854
|
+
browserTempOutputRoot,
|
|
1842
1855
|
'browser',
|
|
1843
1856
|
Date.now().toString(),
|
|
1844
1857
|
);
|
|
@@ -3225,7 +3238,7 @@ export const listBrowserTests = async (
|
|
|
3225
3238
|
|
|
3226
3239
|
const tempDir = join(
|
|
3227
3240
|
context.rootPath,
|
|
3228
|
-
|
|
3241
|
+
context.normalizedConfig.output.distPath.root,
|
|
3229
3242
|
'browser',
|
|
3230
3243
|
`list-${Date.now()}`,
|
|
3231
3244
|
);
|
package/src/protocol.ts
CHANGED
|
@@ -9,12 +9,8 @@ import type { SnapshotUpdateState } from '@vitest/snapshot';
|
|
|
9
9
|
|
|
10
10
|
export type {
|
|
11
11
|
BrowserLocatorIR,
|
|
12
|
-
BrowserLocatorStep,
|
|
13
|
-
BrowserLocatorText,
|
|
14
12
|
BrowserRpcRequest,
|
|
15
|
-
BrowserRpcResponse,
|
|
16
13
|
SnapshotRpcRequest,
|
|
17
|
-
SnapshotRpcResponse,
|
|
18
14
|
} from './rpcProtocol';
|
|
19
15
|
export { validateBrowserRpcRequest } from './rpcProtocol';
|
|
20
16
|
|
|
@@ -166,11 +162,6 @@ export type BrowserDispatchResponse = {
|
|
|
166
162
|
stale?: boolean;
|
|
167
163
|
};
|
|
168
164
|
|
|
169
|
-
export type BrowserDispatchResponseEnvelope = {
|
|
170
|
-
type: typeof DISPATCH_RESPONSE_TYPE;
|
|
171
|
-
payload: BrowserDispatchResponse;
|
|
172
|
-
};
|
|
173
|
-
|
|
174
165
|
export type BrowserDispatchHandler = (
|
|
175
166
|
request: BrowserDispatchRequest,
|
|
176
167
|
) => Promise<unknown>;
|
package/src/rpcProtocol.ts
CHANGED
|
@@ -178,12 +178,6 @@ export const validateBrowserRpcRequest = (
|
|
|
178
178
|
return request;
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
-
export type BrowserRpcResponse = {
|
|
182
|
-
id: string;
|
|
183
|
-
result?: unknown;
|
|
184
|
-
error?: string;
|
|
185
|
-
};
|
|
186
|
-
|
|
187
181
|
/**
|
|
188
182
|
* Snapshot RPC request from runner iframe.
|
|
189
183
|
* The container will forward these to the host via WebSocket RPC.
|
|
@@ -209,12 +203,3 @@ export type SnapshotRpcRequest =
|
|
|
209
203
|
method: 'removeSnapshotFile';
|
|
210
204
|
args: { filepath: string };
|
|
211
205
|
};
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Snapshot RPC response from container to runner iframe.
|
|
215
|
-
*/
|
|
216
|
-
export type SnapshotRpcResponse = {
|
|
217
|
-
id: string;
|
|
218
|
-
result?: unknown;
|
|
219
|
-
error?: string;
|
|
220
|
-
};
|
package/src/sessionRegistry.ts
CHANGED
package/src/watchCliShortcuts.ts
CHANGED
package/src/watchRerunPlanner.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalize } from 'pathe';
|
|
2
2
|
import type { TestFileInfo } from './protocol';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type WatchPlannerProjectEntry = {
|
|
5
5
|
project: {
|
|
6
6
|
name: string;
|
|
7
7
|
};
|
|
@@ -14,7 +14,7 @@ type WatchRerunPlannerInput = {
|
|
|
14
14
|
affectedTestFiles: string[];
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
type WatchRerunPlan = {
|
|
18
18
|
currentTestFiles: TestFileInfo[];
|
|
19
19
|
filesChanged: boolean;
|
|
20
20
|
normalizedAffectedTestFiles: string[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! LICENSE: 927.514b181bd2.js.LICENSE.txt */
|