@rstest/browser 0.7.9

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.
@@ -0,0 +1,134 @@
1
+ import type { RuntimeConfig, Test, TestFileResult, TestResult } from '@rstest/core/browser-runtime';
2
+ import type { SnapshotUpdateState } from '@vitest/snapshot';
3
+ export type SerializedRuntimeConfig = RuntimeConfig;
4
+ export type BrowserProjectRuntime = {
5
+ name: string;
6
+ environmentName: string;
7
+ projectRoot: string;
8
+ runtimeConfig: SerializedRuntimeConfig;
9
+ };
10
+ /**
11
+ * Test file info with associated project name.
12
+ * Used to track which project a test file belongs to.
13
+ */
14
+ export type TestFileInfo = {
15
+ testPath: string;
16
+ projectName: string;
17
+ };
18
+ /**
19
+ * Execution mode for browser tests.
20
+ * - 'run': Execute tests and report results (default)
21
+ * - 'collect': Only collect test metadata without running
22
+ */
23
+ export type BrowserExecutionMode = 'run' | 'collect';
24
+ export type BrowserHostConfig = {
25
+ rootPath: string;
26
+ projects: BrowserProjectRuntime[];
27
+ snapshot: {
28
+ updateSnapshot: SnapshotUpdateState;
29
+ };
30
+ testFile?: string;
31
+ /**
32
+ * Base URL for runner (iframe) pages.
33
+ */
34
+ runnerUrl?: string;
35
+ /**
36
+ * WebSocket port for container RPC.
37
+ */
38
+ wsPort?: number;
39
+ /**
40
+ * Execution mode. Defaults to 'run'.
41
+ */
42
+ mode?: BrowserExecutionMode;
43
+ /**
44
+ * Debug mode. When true, enables verbose logging in browser.
45
+ */
46
+ debug?: boolean;
47
+ /**
48
+ * Timeout for RPC operations in milliseconds (e.g., snapshot file operations).
49
+ * Derived from testTimeout config.
50
+ */
51
+ rpcTimeout?: number;
52
+ };
53
+ export type BrowserClientMessage = {
54
+ type: 'ready';
55
+ } | {
56
+ type: 'file-start';
57
+ payload: {
58
+ testPath: string;
59
+ projectName: string;
60
+ };
61
+ } | {
62
+ type: 'case-result';
63
+ payload: TestResult;
64
+ } | {
65
+ type: 'file-complete';
66
+ payload: TestFileResult;
67
+ } | {
68
+ type: 'log';
69
+ payload: {
70
+ level: 'log' | 'warn' | 'error' | 'info' | 'debug';
71
+ content: string;
72
+ testPath: string;
73
+ type: 'stdout' | 'stderr';
74
+ trace?: string;
75
+ };
76
+ } | {
77
+ type: 'fatal';
78
+ payload: {
79
+ message: string;
80
+ stack?: string;
81
+ };
82
+ } | {
83
+ type: 'complete';
84
+ } | {
85
+ type: 'collect-result';
86
+ payload: {
87
+ testPath: string;
88
+ project: string;
89
+ tests: Test[];
90
+ };
91
+ } | {
92
+ type: 'collect-complete';
93
+ } | {
94
+ type: 'snapshot-rpc-request';
95
+ payload: SnapshotRpcRequest;
96
+ };
97
+ /**
98
+ * Snapshot RPC request from runner iframe.
99
+ * The container will forward these to the host via WebSocket RPC.
100
+ */
101
+ export type SnapshotRpcRequest = {
102
+ id: string;
103
+ method: 'resolveSnapshotPath';
104
+ args: {
105
+ testPath: string;
106
+ };
107
+ } | {
108
+ id: string;
109
+ method: 'readSnapshotFile';
110
+ args: {
111
+ filepath: string;
112
+ };
113
+ } | {
114
+ id: string;
115
+ method: 'saveSnapshotFile';
116
+ args: {
117
+ filepath: string;
118
+ content: string;
119
+ };
120
+ } | {
121
+ id: string;
122
+ method: 'removeSnapshotFile';
123
+ args: {
124
+ filepath: string;
125
+ };
126
+ };
127
+ /**
128
+ * Snapshot RPC response from container to runner iframe.
129
+ */
130
+ export type SnapshotRpcResponse = {
131
+ id: string;
132
+ result?: unknown;
133
+ error?: string;
134
+ };
@@ -0,0 +1,18 @@
1
+ var __webpack_modules__ = {};
2
+ var __webpack_module_cache__ = {};
3
+ function __webpack_require__(moduleId) {
4
+ var cachedModule = __webpack_module_cache__[moduleId];
5
+ if (void 0 !== cachedModule) return cachedModule.exports;
6
+ var module = __webpack_module_cache__[moduleId] = {
7
+ exports: {}
8
+ };
9
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
10
+ return module.exports;
11
+ }
12
+ __webpack_require__.m = __webpack_modules__;
13
+ (()=>{
14
+ __webpack_require__.add = function(modules) {
15
+ Object.assign(__webpack_require__.m, modules);
16
+ };
17
+ })();
18
+ export { __webpack_require__ };
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@rstest/browser",
3
+ "version": "0.7.9",
4
+ "description": "Browser mode support for Rstest testing framework.",
5
+ "bugs": {
6
+ "url": "https://github.com/web-infra-dev/rstest/issues"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/web-infra-dev/rstest",
11
+ "directory": "packages/browser"
12
+ },
13
+ "keywords": [
14
+ "rstest",
15
+ "browser",
16
+ "test",
17
+ "rstack",
18
+ "rspack"
19
+ ],
20
+ "license": "MIT",
21
+ "type": "module",
22
+ "main": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "default": "./dist/index.js"
28
+ },
29
+ "./package.json": {
30
+ "default": "./package.json"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist",
35
+ "src"
36
+ ],
37
+ "scripts": {
38
+ "build": "rslib build",
39
+ "typecheck": "tsc --noEmit",
40
+ "dev": "rslib build --watch"
41
+ },
42
+ "dependencies": {
43
+ "@jridgewell/trace-mapping": "0.3.31",
44
+ "convert-source-map": "^2.0.0",
45
+ "open-editor": "^4.0.0",
46
+ "pathe": "^2.0.3",
47
+ "sirv": "^2.0.4",
48
+ "ws": "^8.18.3"
49
+ },
50
+ "devDependencies": {
51
+ "@rslib/core": "^0.19.0",
52
+ "@rstest/browser-ui": "workspace:*",
53
+ "@rstest/core": "workspace:*",
54
+ "@rstest/tsconfig": "workspace:*",
55
+ "@types/convert-source-map": "^2.0.3",
56
+ "@types/picomatch": "^4.0.2",
57
+ "@types/ws": "^8.18.1",
58
+ "@vitest/snapshot": "^3.2.4",
59
+ "birpc": "2.9.0",
60
+ "picocolors": "^1.1.1",
61
+ "picomatch": "^4.0.3",
62
+ "playwright": "^1.49.1"
63
+ },
64
+ "peerDependencies": {
65
+ "@rstest/core": "workspace:^",
66
+ "playwright": "^1.49.1"
67
+ },
68
+ "peerDependenciesMeta": {
69
+ "playwright": {
70
+ "optional": true
71
+ }
72
+ },
73
+ "engines": {
74
+ "node": ">=18.12.0"
75
+ },
76
+ "publishConfig": {
77
+ "access": "public",
78
+ "registry": "https://registry.npmjs.org/"
79
+ }
80
+ }