@rstest/browser 0.9.3 → 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 +255 -32
- 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 +45 -34
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! LICENSE: 677.d1243053e0.js.LICENSE.txt */
|
package/dist/browser-container/container-static/js/{index.5acf502b10.js → index.cb4870ffcc.js}
RENAMED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
5645 (e, t, s) {
|
|
5
5
|
var l = s(6730);
|
|
6
6
|
let r = "__rstest_dispatch_response__", o = "runner";
|
|
7
|
-
var a = s(
|
|
7
|
+
var a = s(1215), i = s(7267), n = s(7723), c = s(162), d = s(2739);
|
|
8
8
|
let u = (e)=>{
|
|
9
9
|
let { message: t } = e;
|
|
10
10
|
return (0, l.jsx)("div", {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
})
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
-
var p = s(
|
|
18
|
+
var p = s(367), h = s(4681), f = s(4335), x = s(6942), m = s(396);
|
|
19
19
|
let g = (e, t)=>{
|
|
20
20
|
if (!t) return e;
|
|
21
21
|
let s = t.endsWith("/") ? t.slice(0, -1) : t;
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
})
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
var S = s(
|
|
81
|
+
var S = s(3897), F = s(3146), N = s(9596), A = s(1309), P = s(5758), M = s(9031), z = s(3168), O = s(2024);
|
|
82
82
|
let R = {
|
|
83
83
|
iPhoneSE: {
|
|
84
84
|
width: 375,
|
|
@@ -514,7 +514,7 @@
|
|
|
514
514
|
]
|
|
515
515
|
});
|
|
516
516
|
};
|
|
517
|
-
var G = s(
|
|
517
|
+
var G = s(112);
|
|
518
518
|
let Z = (e)=>{
|
|
519
519
|
let { className: t, style: s, direction: r = "horizontal", children: o, autoSaveId: a, ...i } = e, n = c.Children.toArray(o).filter((e)=>c.isValidElement(e) && e.type === L), d = c.useCallback(()=>{
|
|
520
520
|
if (!a) return null;
|
|
@@ -1585,7 +1585,7 @@
|
|
|
1585
1585
|
]
|
|
1586
1586
|
});
|
|
1587
1587
|
};
|
|
1588
|
-
var K = s(
|
|
1588
|
+
var K = s(3663), Y = s(4923), Q = s(8346), ee = s(407), et = s(3571), es = s(288);
|
|
1589
1589
|
let el = (0, c.memo)((e)=>{
|
|
1590
1590
|
let { counts: t, isRunning: s } = e, r = s && 0 === t.running;
|
|
1591
1591
|
return (0, l.jsx)("div", {
|
|
@@ -1725,7 +1725,7 @@
|
|
|
1725
1725
|
]
|
|
1726
1726
|
});
|
|
1727
1727
|
};
|
|
1728
|
-
var eo = s(
|
|
1728
|
+
var eo = s(1505), ea = s(8198), ei = s(2559), en = s(7957), ec = s(719);
|
|
1729
1729
|
let ed = [
|
|
1730
1730
|
"pass",
|
|
1731
1731
|
"fail",
|
|
@@ -3069,7 +3069,7 @@
|
|
|
3069
3069
|
}, (o = self.rspackChunk_rstest_browser_ui = self.rspackChunk_rstest_browser_ui || []).forEach(r.bind(null, 0)), o.push = r.bind(null, o.push.bind(o));
|
|
3070
3070
|
var c = n.O(void 0, [
|
|
3071
3071
|
"783",
|
|
3072
|
-
"
|
|
3072
|
+
"677"
|
|
3073
3073
|
], ()=>n(5645));
|
|
3074
3074
|
c = n.O(c);
|
|
3075
3075
|
})();
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<script>
|
|
13
13
|
window.__RSTEST_BROWSER_OPTIONS__ = __RSTEST_OPTIONS_PLACEHOLDER__;
|
|
14
14
|
</script>
|
|
15
|
-
<script defer src="/container-static/js/lib-react.f905279759.js"></script><script defer src="/container-static/js/
|
|
15
|
+
<script defer src="/container-static/js/lib-react.f905279759.js"></script><script defer src="/container-static/js/677.d1243053e0.js"></script><script defer src="/container-static/js/index.cb4870ffcc.js"></script><link href="/container-static/css/index.5c72297783.css" rel="stylesheet"></head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="root"></div>
|
|
18
18
|
</body>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { BrowserDispatchRequest } from '../protocol';
|
|
2
|
-
export declare const DEFAULT_RPC_TIMEOUT_MS = 30000;
|
|
3
2
|
export declare const getRpcTimeout: () => number;
|
|
4
3
|
export declare const createRequestId: (prefix: string) => string;
|
|
5
4
|
export declare const dispatchRpc: <T>({ requestId, request, timeoutMs, timeoutMessage, staleMessage, }: {
|
|
@@ -25,14 +25,10 @@ export declare const preloadTestFileSourceMap: (chunkUrl: string) => Promise<voi
|
|
|
25
25
|
* to the original source files.
|
|
26
26
|
*/
|
|
27
27
|
export declare const preloadRunnerSourceMap: () => Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Clear cache (for testing purposes)
|
|
30
|
-
*/
|
|
31
|
-
export declare const clearCache: () => void;
|
|
32
28
|
/**
|
|
33
29
|
* Stack frame interface matching @vitest/snapshot's format
|
|
34
30
|
*/
|
|
35
|
-
|
|
31
|
+
interface StackFrame {
|
|
36
32
|
file: string;
|
|
37
33
|
line: number;
|
|
38
34
|
column: number;
|
|
@@ -43,3 +39,4 @@ export interface StackFrame {
|
|
|
43
39
|
* This is used by BrowserSnapshotEnvironment.processStackTrace
|
|
44
40
|
*/
|
|
45
41
|
export declare const mapStackFrame: (frame: StackFrame) => StackFrame;
|
|
42
|
+
export {};
|
package/dist/concurrency.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Rstest } from '@rstest/core/browser';
|
|
2
|
-
|
|
2
|
+
type HeadlessConcurrencyContext = Pick<Rstest, 'command'> & {
|
|
3
3
|
normalizedConfig: {
|
|
4
4
|
pool: {
|
|
5
5
|
maxWorkers?: string | number;
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
export declare const getNumCpus: () => number;
|
|
10
9
|
export declare const parseWorkers: (maxWorkers: string | number, numCpus?: number) => number;
|
|
11
10
|
export declare const resolveDefaultHeadlessWorkers: (command: HeadlessConcurrencyContext["command"], numCpus?: number) => number;
|
|
12
11
|
export declare const getHeadlessConcurrency: (context: HeadlessConcurrencyContext, totalTests: number) => number;
|
|
12
|
+
export {};
|
|
@@ -12,7 +12,7 @@ type RunnerDispatchFileReadyPayload = ReporterHookArg<'onTestFileReady'>;
|
|
|
12
12
|
type RunnerDispatchSuiteStartPayload = ReporterHookArg<'onTestSuiteStart'>;
|
|
13
13
|
type RunnerDispatchSuiteResultPayload = ReporterHookArg<'onTestSuiteResult'>;
|
|
14
14
|
type RunnerDispatchCaseStartPayload = ReporterHookArg<'onTestCaseStart'>;
|
|
15
|
-
|
|
15
|
+
type RunnerDispatchCallbacks = {
|
|
16
16
|
onTestFileStart: (payload: RunnerPayload<'file-start'>) => Promise<void>;
|
|
17
17
|
onTestFileReady: (payload: RunnerDispatchFileReadyPayload) => Promise<void>;
|
|
18
18
|
onTestSuiteStart: (payload: RunnerDispatchSuiteStartPayload) => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type HeadedSerialTask = () => Promise<void>;
|
|
2
2
|
/**
|
|
3
3
|
* Serializes headed browser file execution so only one task runs at a time.
|
|
4
4
|
* The queue keeps draining even if an earlier task rejects.
|
|
@@ -6,3 +6,4 @@ export type HeadedSerialTask = () => Promise<void>;
|
|
|
6
6
|
export declare const createHeadedSerialTaskQueue: () => {
|
|
7
7
|
enqueue: (task: HeadedSerialTask) => Promise<void>;
|
|
8
8
|
};
|
|
9
|
+
export {};
|
package/dist/hostController.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ type BrowserLazyCompilationConfig = {
|
|
|
8
8
|
test?: (module: LazyCompilationModule) => boolean;
|
|
9
9
|
};
|
|
10
10
|
export declare const createBrowserLazyCompilationConfig: (setupFiles: string[]) => BrowserLazyCompilationConfig;
|
|
11
|
-
export declare const createBrowserRsbuildDevConfig: (
|
|
11
|
+
export declare const createBrowserRsbuildDevConfig: (_isWatchMode: boolean) => {
|
|
12
|
+
writeToDisk: boolean;
|
|
12
13
|
hmr: boolean;
|
|
13
14
|
client: {
|
|
14
15
|
logLevel: "error";
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { existsSync } from "node:fs";
|
|
|
3
3
|
import promises from "node:fs/promises";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { isDeepStrictEqual } from "node:util";
|
|
6
|
-
import {
|
|
6
|
+
import { color, getSetupFiles, getTestEntries, isDebug, loadCoverageProvider, logger, rsbuild, serializableConfig } from "@rstest/core/browser";
|
|
7
7
|
import open_editor from "open-editor";
|
|
8
8
|
import { basename, dirname, join, normalize, relative, resolve as external_pathe_resolve } from "pathe";
|
|
9
9
|
import sirv from "sirv";
|
|
@@ -12,9 +12,9 @@ import node_os from "node:os";
|
|
|
12
12
|
import convert_source_map from "convert-source-map";
|
|
13
13
|
import { DISPATCH_RPC_BRIDGE_NAME, DISPATCH_MESSAGE_TYPE, DISPATCH_NAMESPACE_RUNNER } from "./323.js";
|
|
14
14
|
__webpack_require__.add({
|
|
15
|
-
"../../node_modules/.pnpm/picomatch@4.0.
|
|
16
|
-
const pico = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.
|
|
17
|
-
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.
|
|
15
|
+
"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
16
|
+
const pico = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js");
|
|
17
|
+
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");
|
|
18
18
|
function picomatch(glob, options, returnState = false) {
|
|
19
19
|
if (options && (null === options.windows || void 0 === options.windows)) options = {
|
|
20
20
|
...options,
|
|
@@ -25,9 +25,10 @@ __webpack_require__.add({
|
|
|
25
25
|
Object.assign(picomatch, pico);
|
|
26
26
|
module.exports = picomatch;
|
|
27
27
|
},
|
|
28
|
-
"../../node_modules/.pnpm/picomatch@4.0.
|
|
28
|
+
"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js" (module) {
|
|
29
29
|
const WIN_SLASH = '\\\\/';
|
|
30
30
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
31
|
+
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
31
32
|
const DOT_LITERAL = '\\.';
|
|
32
33
|
const PLUS_LITERAL = '\\+';
|
|
33
34
|
const QMARK_LITERAL = '\\?';
|
|
@@ -78,6 +79,7 @@ __webpack_require__.add({
|
|
|
78
79
|
SEP: '\\'
|
|
79
80
|
};
|
|
80
81
|
const POSIX_REGEX_SOURCE = {
|
|
82
|
+
__proto__: null,
|
|
81
83
|
alnum: 'a-zA-Z0-9',
|
|
82
84
|
alpha: 'a-zA-Z',
|
|
83
85
|
ascii: '\\x00-\\x7F',
|
|
@@ -94,6 +96,7 @@ __webpack_require__.add({
|
|
|
94
96
|
xdigit: 'A-Fa-f0-9'
|
|
95
97
|
};
|
|
96
98
|
module.exports = {
|
|
99
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
97
100
|
MAX_LENGTH: 65536,
|
|
98
101
|
POSIX_REGEX_SOURCE,
|
|
99
102
|
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
@@ -185,9 +188,9 @@ __webpack_require__.add({
|
|
|
185
188
|
}
|
|
186
189
|
};
|
|
187
190
|
},
|
|
188
|
-
"../../node_modules/.pnpm/picomatch@4.0.
|
|
189
|
-
const constants = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.
|
|
190
|
-
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.
|
|
191
|
+
"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
192
|
+
const constants = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js");
|
|
193
|
+
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");
|
|
191
194
|
const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
|
|
192
195
|
const expandRange = (args, options)=>{
|
|
193
196
|
if ('function' == typeof options.expandRange) return options.expandRange(...args, options);
|
|
@@ -201,6 +204,189 @@ __webpack_require__.add({
|
|
|
201
204
|
return value;
|
|
202
205
|
};
|
|
203
206
|
const syntaxError = (type, char)=>`Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
207
|
+
const splitTopLevel = (input)=>{
|
|
208
|
+
const parts = [];
|
|
209
|
+
let bracket = 0;
|
|
210
|
+
let paren = 0;
|
|
211
|
+
let quote = 0;
|
|
212
|
+
let value = '';
|
|
213
|
+
let escaped = false;
|
|
214
|
+
for (const ch of input){
|
|
215
|
+
if (true === escaped) {
|
|
216
|
+
value += ch;
|
|
217
|
+
escaped = false;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if ('\\' === ch) {
|
|
221
|
+
value += ch;
|
|
222
|
+
escaped = true;
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
if ('"' === ch) {
|
|
226
|
+
quote = 1 === quote ? 0 : 1;
|
|
227
|
+
value += ch;
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
if (0 === quote) {
|
|
231
|
+
if ('[' === ch) bracket++;
|
|
232
|
+
else if (']' === ch && bracket > 0) bracket--;
|
|
233
|
+
else if (0 === bracket) {
|
|
234
|
+
if ('(' === ch) paren++;
|
|
235
|
+
else if (')' === ch && paren > 0) paren--;
|
|
236
|
+
else if ('|' === ch && 0 === paren) {
|
|
237
|
+
parts.push(value);
|
|
238
|
+
value = '';
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
value += ch;
|
|
244
|
+
}
|
|
245
|
+
parts.push(value);
|
|
246
|
+
return parts;
|
|
247
|
+
};
|
|
248
|
+
const isPlainBranch = (branch)=>{
|
|
249
|
+
let escaped = false;
|
|
250
|
+
for (const ch of branch){
|
|
251
|
+
if (true === escaped) {
|
|
252
|
+
escaped = false;
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
if ('\\' === ch) {
|
|
256
|
+
escaped = true;
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
if (/[?*+@!()[\]{}]/.test(ch)) return false;
|
|
260
|
+
}
|
|
261
|
+
return true;
|
|
262
|
+
};
|
|
263
|
+
const normalizeSimpleBranch = (branch)=>{
|
|
264
|
+
let value = branch.trim();
|
|
265
|
+
let changed = true;
|
|
266
|
+
while(true === changed){
|
|
267
|
+
changed = false;
|
|
268
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
269
|
+
value = value.slice(2, -1);
|
|
270
|
+
changed = true;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (!isPlainBranch(value)) return;
|
|
274
|
+
return value.replace(/\\(.)/g, '$1');
|
|
275
|
+
};
|
|
276
|
+
const hasRepeatedCharPrefixOverlap = (branches)=>{
|
|
277
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
278
|
+
for(let i = 0; i < values.length; i++)for(let j = i + 1; j < values.length; j++){
|
|
279
|
+
const a = values[i];
|
|
280
|
+
const b = values[j];
|
|
281
|
+
const char = a[0];
|
|
282
|
+
if (char && a === char.repeat(a.length) && b === char.repeat(b.length)) {
|
|
283
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return false;
|
|
287
|
+
};
|
|
288
|
+
const parseRepeatedExtglob = (pattern, requireEnd = true)=>{
|
|
289
|
+
if ('+' !== pattern[0] && '*' !== pattern[0] || '(' !== pattern[1]) return;
|
|
290
|
+
let bracket = 0;
|
|
291
|
+
let paren = 0;
|
|
292
|
+
let quote = 0;
|
|
293
|
+
let escaped = false;
|
|
294
|
+
for(let i = 1; i < pattern.length; i++){
|
|
295
|
+
const ch = pattern[i];
|
|
296
|
+
if (true === escaped) {
|
|
297
|
+
escaped = false;
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if ('\\' === ch) {
|
|
301
|
+
escaped = true;
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
if ('"' === ch) {
|
|
305
|
+
quote = 1 === quote ? 0 : 1;
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
if (1 !== quote) {
|
|
309
|
+
if ('[' === ch) {
|
|
310
|
+
bracket++;
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
if (']' === ch && bracket > 0) {
|
|
314
|
+
bracket--;
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
if (!(bracket > 0)) {
|
|
318
|
+
if ('(' === ch) {
|
|
319
|
+
paren++;
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
if (')' === ch) {
|
|
323
|
+
paren--;
|
|
324
|
+
if (0 === paren) {
|
|
325
|
+
if (true === requireEnd && i !== pattern.length - 1) return;
|
|
326
|
+
return {
|
|
327
|
+
type: pattern[0],
|
|
328
|
+
body: pattern.slice(2, i),
|
|
329
|
+
end: i
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
const getStarExtglobSequenceOutput = (pattern)=>{
|
|
338
|
+
let index = 0;
|
|
339
|
+
const chars = [];
|
|
340
|
+
while(index < pattern.length){
|
|
341
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
342
|
+
if (!match || '*' !== match.type) return;
|
|
343
|
+
const branches = splitTopLevel(match.body).map((branch)=>branch.trim());
|
|
344
|
+
if (1 !== branches.length) return;
|
|
345
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
346
|
+
if (!branch || 1 !== branch.length) return;
|
|
347
|
+
chars.push(branch);
|
|
348
|
+
index += match.end + 1;
|
|
349
|
+
}
|
|
350
|
+
if (chars.length < 1) return;
|
|
351
|
+
const source = 1 === chars.length ? utils.escapeRegex(chars[0]) : `[${chars.map((ch)=>utils.escapeRegex(ch)).join('')}]`;
|
|
352
|
+
return `${source}*`;
|
|
353
|
+
};
|
|
354
|
+
const repeatedExtglobRecursion = (pattern)=>{
|
|
355
|
+
let depth = 0;
|
|
356
|
+
let value = pattern.trim();
|
|
357
|
+
let match = parseRepeatedExtglob(value);
|
|
358
|
+
while(match){
|
|
359
|
+
depth++;
|
|
360
|
+
value = match.body.trim();
|
|
361
|
+
match = parseRepeatedExtglob(value);
|
|
362
|
+
}
|
|
363
|
+
return depth;
|
|
364
|
+
};
|
|
365
|
+
const analyzeRepeatedExtglob = (body, options)=>{
|
|
366
|
+
if (false === options.maxExtglobRecursion) return {
|
|
367
|
+
risky: false
|
|
368
|
+
};
|
|
369
|
+
const max = 'number' == typeof options.maxExtglobRecursion ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
370
|
+
const branches = splitTopLevel(body).map((branch)=>branch.trim());
|
|
371
|
+
if (branches.length > 1) {
|
|
372
|
+
if (branches.some((branch)=>'' === branch) || branches.some((branch)=>/^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return {
|
|
373
|
+
risky: true
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
for (const branch of branches){
|
|
377
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
378
|
+
if (safeOutput) return {
|
|
379
|
+
risky: true,
|
|
380
|
+
safeOutput
|
|
381
|
+
};
|
|
382
|
+
if (repeatedExtglobRecursion(branch) > max) return {
|
|
383
|
+
risky: true
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
return {
|
|
387
|
+
risky: false
|
|
388
|
+
};
|
|
389
|
+
};
|
|
204
390
|
const parse = (input, options)=>{
|
|
205
391
|
if ('string' != typeof input) throw new TypeError('Expected a string');
|
|
206
392
|
input = REPLACEMENTS[input] || input;
|
|
@@ -316,6 +502,8 @@ __webpack_require__.add({
|
|
|
316
502
|
token.prev = prev;
|
|
317
503
|
token.parens = state.parens;
|
|
318
504
|
token.output = state.output;
|
|
505
|
+
token.startIndex = state.index;
|
|
506
|
+
token.tokensIndex = tokens.length;
|
|
319
507
|
const output = (opts.capture ? '(' : '') + token.open;
|
|
320
508
|
increment('parens');
|
|
321
509
|
push({
|
|
@@ -332,6 +520,31 @@ __webpack_require__.add({
|
|
|
332
520
|
extglobs.push(token);
|
|
333
521
|
};
|
|
334
522
|
const extglobClose = (token)=>{
|
|
523
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
524
|
+
const body = input.slice(token.startIndex + 2, state.index);
|
|
525
|
+
const analysis = analyzeRepeatedExtglob(body, opts);
|
|
526
|
+
if (('plus' === token.type || 'star' === token.type) && analysis.risky) {
|
|
527
|
+
const safeOutput = analysis.safeOutput ? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
|
|
528
|
+
const open = tokens[token.tokensIndex];
|
|
529
|
+
open.type = 'text';
|
|
530
|
+
open.value = literal;
|
|
531
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
532
|
+
for(let i = token.tokensIndex + 1; i < tokens.length; i++){
|
|
533
|
+
tokens[i].value = '';
|
|
534
|
+
tokens[i].output = '';
|
|
535
|
+
delete tokens[i].suffix;
|
|
536
|
+
}
|
|
537
|
+
state.output = token.output + open.output;
|
|
538
|
+
state.backtrack = true;
|
|
539
|
+
push({
|
|
540
|
+
type: 'paren',
|
|
541
|
+
extglob: true,
|
|
542
|
+
value,
|
|
543
|
+
output: ''
|
|
544
|
+
});
|
|
545
|
+
decrement('parens');
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
335
548
|
let output = token.close + (opts.capture ? ')' : '');
|
|
336
549
|
let rest;
|
|
337
550
|
if ('negate' === token.type) {
|
|
@@ -973,11 +1186,11 @@ __webpack_require__.add({
|
|
|
973
1186
|
};
|
|
974
1187
|
module.exports = parse;
|
|
975
1188
|
},
|
|
976
|
-
"../../node_modules/.pnpm/picomatch@4.0.
|
|
977
|
-
const scan = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.
|
|
978
|
-
const parse = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.
|
|
979
|
-
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.
|
|
980
|
-
const constants = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.
|
|
1189
|
+
"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1190
|
+
const scan = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js");
|
|
1191
|
+
const parse = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js");
|
|
1192
|
+
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");
|
|
1193
|
+
const constants = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js");
|
|
981
1194
|
const isObject = (val)=>val && 'object' == typeof val && !Array.isArray(val);
|
|
982
1195
|
const picomatch = (glob, options, returnState = false)=>{
|
|
983
1196
|
if (Array.isArray(glob)) {
|
|
@@ -1106,9 +1319,9 @@ __webpack_require__.add({
|
|
|
1106
1319
|
picomatch.constants = constants;
|
|
1107
1320
|
module.exports = picomatch;
|
|
1108
1321
|
},
|
|
1109
|
-
"../../node_modules/.pnpm/picomatch@4.0.
|
|
1110
|
-
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.
|
|
1111
|
-
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.
|
|
1322
|
+
"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
1323
|
+
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");
|
|
1324
|
+
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js");
|
|
1112
1325
|
const isPathSeparator = (code)=>code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
1113
1326
|
const depth = (token)=>{
|
|
1114
1327
|
if (true !== token.isPrefix) token.depth = token.isGlobstar ? 1 / 0 : 1;
|
|
@@ -1374,8 +1587,8 @@ __webpack_require__.add({
|
|
|
1374
1587
|
};
|
|
1375
1588
|
module.exports = scan;
|
|
1376
1589
|
},
|
|
1377
|
-
"../../node_modules/.pnpm/picomatch@4.0.
|
|
1378
|
-
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.
|
|
1590
|
+
"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
1591
|
+
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js");
|
|
1379
1592
|
exports.isObject = (val)=>null !== val && 'object' == typeof val && !Array.isArray(val);
|
|
1380
1593
|
exports.hasRegexChars = (str)=>REGEX_SPECIAL_CHARS.test(str);
|
|
1381
1594
|
exports.isRegexChar = (str)=>1 === str.length && exports.hasRegexChars(str);
|
|
@@ -2582,7 +2795,7 @@ const planWatchRerun = ({ projectEntries, previousTestFiles, affectedTestFiles }
|
|
|
2582
2795
|
affectedTestFiles: matchedAffectedFiles
|
|
2583
2796
|
};
|
|
2584
2797
|
};
|
|
2585
|
-
const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.
|
|
2798
|
+
const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js");
|
|
2586
2799
|
var picomatch_default = /*#__PURE__*/ __webpack_require__.n(picomatch);
|
|
2587
2800
|
const { createRsbuild: createRsbuild, rspack: rspack } = rsbuild;
|
|
2588
2801
|
const hostController_dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -2753,8 +2966,9 @@ const createBrowserLazyCompilationConfig = (setupFiles)=>{
|
|
|
2753
2966
|
}
|
|
2754
2967
|
};
|
|
2755
2968
|
};
|
|
2756
|
-
const createBrowserRsbuildDevConfig = (
|
|
2757
|
-
|
|
2969
|
+
const createBrowserRsbuildDevConfig = (_isWatchMode)=>({
|
|
2970
|
+
writeToDisk: isDebug(),
|
|
2971
|
+
hmr: true,
|
|
2758
2972
|
client: {
|
|
2759
2973
|
logLevel: 'error'
|
|
2760
2974
|
}
|
|
@@ -2894,9 +3108,8 @@ const resolveProviderForTestPath = ({ testPath, browserProjects })=>{
|
|
|
2894
3108
|
throw new Error(`Cannot resolve browser provider for test path: ${JSON.stringify(testPath)}. Known project roots: ${JSON.stringify(sortedProjects.map((p)=>p.rootPath))}`);
|
|
2895
3109
|
};
|
|
2896
3110
|
const collectProjectEntries = async (context)=>{
|
|
2897
|
-
const projectEntries = [];
|
|
2898
3111
|
const browserProjects = getBrowserProjects(context);
|
|
2899
|
-
|
|
3112
|
+
return Promise.all(browserProjects.map(async (project)=>{
|
|
2900
3113
|
const { normalizedConfig: { include, exclude, includeSource, setupFiles } } = project;
|
|
2901
3114
|
const tests = await getTestEntries({
|
|
2902
3115
|
include,
|
|
@@ -2907,13 +3120,12 @@ const collectProjectEntries = async (context)=>{
|
|
|
2907
3120
|
fileFilters: context.fileFilters || []
|
|
2908
3121
|
});
|
|
2909
3122
|
const setup = getSetupFiles(setupFiles, project.rootPath);
|
|
2910
|
-
|
|
3123
|
+
return {
|
|
2911
3124
|
project,
|
|
2912
3125
|
setupFiles: Object.values(setup),
|
|
2913
3126
|
testFiles: Object.values(tests)
|
|
2914
|
-
}
|
|
2915
|
-
}
|
|
2916
|
-
return projectEntries;
|
|
3127
|
+
};
|
|
3128
|
+
}));
|
|
2917
3129
|
};
|
|
2918
3130
|
const resolveBrowserFile = (relativePath)=>{
|
|
2919
3131
|
const candidates = [
|
|
@@ -3190,6 +3402,15 @@ const createBrowserRuntime = async ({ context, manifestPath, manifestSource, tem
|
|
|
3190
3402
|
const devServer = await rsbuildInstance.createDevServer({
|
|
3191
3403
|
getPortSilently: true
|
|
3192
3404
|
});
|
|
3405
|
+
if (isDebug()) await rsbuildInstance.inspectConfig({
|
|
3406
|
+
writeToDisk: true,
|
|
3407
|
+
extraConfigs: {
|
|
3408
|
+
rstest: {
|
|
3409
|
+
...context.normalizedConfig,
|
|
3410
|
+
projects: browserProjects.map((p)=>p.normalizedConfig)
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
});
|
|
3193
3414
|
const serveContainer = containerDistPath ? sirv(containerDistPath, {
|
|
3194
3415
|
dev: false,
|
|
3195
3416
|
single: 'index.html'
|
|
@@ -3318,10 +3539,10 @@ const createBrowserRuntime = async ({ context, manifestPath, manifestSource, tem
|
|
|
3318
3539
|
dispatchHandlers,
|
|
3319
3540
|
wss
|
|
3320
3541
|
};
|
|
3321
|
-
} catch (
|
|
3542
|
+
} catch (error) {
|
|
3322
3543
|
wss.close();
|
|
3323
3544
|
await devServer.close();
|
|
3324
|
-
throw
|
|
3545
|
+
throw error;
|
|
3325
3546
|
}
|
|
3326
3547
|
};
|
|
3327
3548
|
async function resolveProjectEntries(context, shardedEntries) {
|
|
@@ -3468,7 +3689,8 @@ const runBrowserController = async (context, options)=>{
|
|
|
3468
3689
|
await notifyTestRunStart();
|
|
3469
3690
|
const isWatchMode = 'watch' === context.command;
|
|
3470
3691
|
const enableCliShortcuts = isWatchMode && isBrowserWatchCliShortcutsEnabled();
|
|
3471
|
-
const
|
|
3692
|
+
const browserTempOutputRoot = context.normalizedConfig.output.distPath.root;
|
|
3693
|
+
const tempDir = isWatchMode && watchContext.runtime ? watchContext.runtime.tempDir : isWatchMode ? join(context.rootPath, browserTempOutputRoot, 'browser', 'watch') : join(context.rootPath, browserTempOutputRoot, 'browser', Date.now().toString());
|
|
3472
3694
|
const manifestPath = join(tempDir, VIRTUAL_MANIFEST_FILENAME);
|
|
3473
3695
|
const manifestSource = generateManifestModule({
|
|
3474
3696
|
manifestPath,
|
|
@@ -4287,7 +4509,7 @@ const listBrowserTests = async (context, options)=>{
|
|
|
4287
4509
|
list: [],
|
|
4288
4510
|
close: async ()=>{}
|
|
4289
4511
|
};
|
|
4290
|
-
const tempDir = join(context.rootPath,
|
|
4512
|
+
const tempDir = join(context.rootPath, context.normalizedConfig.output.distPath.root, 'browser', `list-${Date.now()}`);
|
|
4291
4513
|
const manifestPath = join(tempDir, VIRTUAL_MANIFEST_FILENAME);
|
|
4292
4514
|
const manifestSource = generateManifestModule({
|
|
4293
4515
|
manifestPath,
|
|
@@ -4450,12 +4672,13 @@ const validateViewport = (viewport)=>{
|
|
|
4450
4672
|
};
|
|
4451
4673
|
const validateBrowserConfig = (context)=>{
|
|
4452
4674
|
for (const project of context.projects){
|
|
4453
|
-
const browser = project.normalizedConfig
|
|
4675
|
+
const { browser, output } = project.normalizedConfig;
|
|
4454
4676
|
if (browser.enabled) {
|
|
4455
4677
|
if (!browser.provider) throw new Error('browser.provider is required when browser.enabled is true.');
|
|
4456
4678
|
if (!SUPPORTED_PROVIDERS.includes(browser.provider)) throw new Error(`browser.provider must be one of: ${SUPPORTED_PROVIDERS.join(', ')}.`);
|
|
4457
4679
|
validateViewport(browser.viewport);
|
|
4458
4680
|
if (!isPlainObject(browser.providerOptions)) throw new Error('browser.providerOptions must be a plain object.');
|
|
4681
|
+
if (output?.bundleDependencies === false) throw new Error('output.bundleDependencies false is not supported in browser mode.');
|
|
4459
4682
|
}
|
|
4460
4683
|
}
|
|
4461
4684
|
};
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DevicePreset } from '@rstest/core/browser';
|
|
2
2
|
import type { RuntimeConfig, TestFileResult, TestInfo, TestResult } from '@rstest/core/browser-runtime';
|
|
3
3
|
import type { SnapshotUpdateState } from '@vitest/snapshot';
|
|
4
|
-
export type { BrowserLocatorIR,
|
|
4
|
+
export type { BrowserLocatorIR, BrowserRpcRequest, SnapshotRpcRequest, } from './rpcProtocol';
|
|
5
5
|
export { validateBrowserRpcRequest } from './rpcProtocol';
|
|
6
6
|
export declare const DISPATCH_MESSAGE_TYPE = "__rstest_dispatch__";
|
|
7
7
|
export declare const DISPATCH_RESPONSE_TYPE = "__rstest_dispatch_response__";
|
|
@@ -144,8 +144,4 @@ export type BrowserDispatchResponse = {
|
|
|
144
144
|
error?: string;
|
|
145
145
|
stale?: boolean;
|
|
146
146
|
};
|
|
147
|
-
export type BrowserDispatchResponseEnvelope = {
|
|
148
|
-
type: typeof DISPATCH_RESPONSE_TYPE;
|
|
149
|
-
payload: BrowserDispatchResponse;
|
|
150
|
-
};
|
|
151
147
|
export type BrowserDispatchHandler = (request: BrowserDispatchRequest) => Promise<unknown>;
|
package/dist/rpcProtocol.d.ts
CHANGED
|
@@ -100,11 +100,6 @@ export type BrowserRpcRequest = {
|
|
|
100
100
|
timeout?: number;
|
|
101
101
|
};
|
|
102
102
|
export declare const validateBrowserRpcRequest: (payload: unknown) => BrowserRpcRequest;
|
|
103
|
-
export type BrowserRpcResponse = {
|
|
104
|
-
id: string;
|
|
105
|
-
result?: unknown;
|
|
106
|
-
error?: string;
|
|
107
|
-
};
|
|
108
103
|
/**
|
|
109
104
|
* Snapshot RPC request from runner iframe.
|
|
110
105
|
* The container will forward these to the host via WebSocket RPC.
|
|
@@ -135,11 +130,3 @@ export type SnapshotRpcRequest = {
|
|
|
135
130
|
filepath: string;
|
|
136
131
|
};
|
|
137
132
|
};
|
|
138
|
-
/**
|
|
139
|
-
* Snapshot RPC response from container to runner iframe.
|
|
140
|
-
*/
|
|
141
|
-
export type SnapshotRpcResponse = {
|
|
142
|
-
id: string;
|
|
143
|
-
result?: unknown;
|
|
144
|
-
error?: string;
|
|
145
|
-
};
|