@rstest/browser 0.8.2 → 0.8.4
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/css/index.5a71c757.css +1 -0
- package/dist/browser-container/container-static/js/{837.e631233e.js → 392.28f9a733.js} +14259 -9646
- package/dist/browser-container/container-static/js/392.28f9a733.js.LICENSE.txt +1 -0
- package/dist/browser-container/container-static/js/{container.93bdade7.js → index.129eaf9c.js} +854 -321
- package/dist/browser-container/container-static/js/{lib-react.48335539.js → lib-react.97ee79b0.js} +22 -22
- package/dist/browser-container/container-static/js/lib-react.97ee79b0.js.LICENSE.txt +1 -0
- package/dist/browser-container/container-static/js/scheduler.6976de44.js +411 -0
- package/dist/browser-container/{container.html → index.html} +1 -1
- package/dist/browser-container/scheduler.html +19 -0
- package/dist/configValidation.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +227 -39
- package/dist/protocol.d.ts +6 -0
- package/dist/viewportPresets.d.ts +16 -0
- package/package.json +4 -4
- package/src/configValidation.ts +66 -0
- package/src/hostController.ts +156 -46
- package/src/index.ts +8 -0
- package/src/protocol.ts +9 -0
- package/src/viewportPresets.ts +64 -0
- package/dist/browser-container/container-static/css/container.425b2695.css +0 -1
- package/dist/browser-container/container-static/js/837.e631233e.js.LICENSE.txt +0 -1
- package/dist/browser-container/container-static/js/lib-react.48335539.js.LICENSE.txt +0 -1
package/dist/browser-container/container-static/js/{lib-react.48335539.js → lib-react.97ee79b0.js}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/*! For license information please see lib-react.
|
|
2
|
-
/*! For license information please see lib-react.
|
|
1
|
+
/*! For license information please see lib-react.97ee79b0.js.LICENSE.txt */
|
|
2
|
+
/*! For license information please see lib-react.97ee79b0.js.LICENSE.txt */ "use strict";
|
|
3
3
|
(self.webpackChunk_rstest_browser_ui = self.webpackChunk_rstest_browser_ui || []).push([
|
|
4
4
|
[
|
|
5
5
|
"783"
|
|
6
6
|
],
|
|
7
7
|
{
|
|
8
|
-
|
|
9
|
-
var r, l = n(1099), a = n(
|
|
8
|
+
7816 (e, t, n) {
|
|
9
|
+
var r, l = n(1099), a = n(162), o = n(5466);
|
|
10
10
|
function i(e) {
|
|
11
11
|
var t = "https://react.dev/errors/" + e;
|
|
12
12
|
if (1 < arguments.length) {
|
|
@@ -7729,7 +7729,7 @@
|
|
|
7729
7729
|
}
|
|
7730
7730
|
};
|
|
7731
7731
|
var cI = a.version;
|
|
7732
|
-
if ("19.2.
|
|
7732
|
+
if ("19.2.4" !== cI) throw Error(i(527, cI, "19.2.4"));
|
|
7733
7733
|
if (F.findDOMNode = function(e) {
|
|
7734
7734
|
var t = e._reactInternals;
|
|
7735
7735
|
if (void 0 === t) {
|
|
@@ -7807,10 +7807,10 @@
|
|
|
7807
7807
|
if (!cU.isDisabled && cU.supportsFiber) try {
|
|
7808
7808
|
ep = cU.inject({
|
|
7809
7809
|
bundleType: 0,
|
|
7810
|
-
version: "19.2.
|
|
7810
|
+
version: "19.2.4",
|
|
7811
7811
|
rendererPackageName: "react-dom",
|
|
7812
7812
|
currentDispatcherRef: D,
|
|
7813
|
-
reconcilerVersion: "19.2.
|
|
7813
|
+
reconcilerVersion: "19.2.4"
|
|
7814
7814
|
}), em = cU;
|
|
7815
7815
|
} catch (e) {}
|
|
7816
7816
|
}
|
|
@@ -7822,10 +7822,10 @@
|
|
|
7822
7822
|
if (!u(e)) throw Error(i(299));
|
|
7823
7823
|
var l = !1, a = "", o = of, s = od, c = op, f = null;
|
|
7824
7824
|
return null != n && (!0 === n.unstable_strictMode && (l = !0), void 0 !== n.identifierPrefix && (a = n.identifierPrefix), void 0 !== n.onUncaughtError && (o = n.onUncaughtError), void 0 !== n.onCaughtError && (s = n.onCaughtError), void 0 !== n.onRecoverableError && (c = n.onRecoverableError), void 0 !== n.formState && (f = n.formState)), (t = cr(e, 1, !0, t, null != n ? n : null, l, a, f, o, s, c, cR)).context = n7, n = t.current, (a = lC(l = eL(l = uo()))).callback = null, l_(n, a, l), n = l, t.current.lanes = n, ez(t, n), uW(t), e[eI] = t.current, se(e), new cM(t);
|
|
7825
|
-
}, t.version = "19.2.
|
|
7825
|
+
}, t.version = "19.2.4";
|
|
7826
7826
|
},
|
|
7827
|
-
|
|
7828
|
-
var r = n(
|
|
7827
|
+
8844 (e, t, n) {
|
|
7828
|
+
var r = n(162);
|
|
7829
7829
|
function l(e) {
|
|
7830
7830
|
var t = "https://react.dev/errors/" + e;
|
|
7831
7831
|
if (1 < arguments.length) {
|
|
@@ -7936,27 +7936,27 @@
|
|
|
7936
7936
|
return u.H.useFormState(e, t, n);
|
|
7937
7937
|
}, t.useFormStatus = function() {
|
|
7938
7938
|
return u.H.useHostTransitionStatus();
|
|
7939
|
-
}, t.version = "19.2.
|
|
7939
|
+
}, t.version = "19.2.4";
|
|
7940
7940
|
},
|
|
7941
|
-
|
|
7941
|
+
2739 (e, t, n) {
|
|
7942
7942
|
(function e() {
|
|
7943
7943
|
if ("u" > typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" == typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE) try {
|
|
7944
7944
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e);
|
|
7945
7945
|
} catch (e) {
|
|
7946
7946
|
console.error(e);
|
|
7947
7947
|
}
|
|
7948
|
-
})(), e.exports = n(
|
|
7948
|
+
})(), e.exports = n(7816);
|
|
7949
7949
|
},
|
|
7950
|
-
|
|
7950
|
+
5466 (e, t, n) {
|
|
7951
7951
|
(function e() {
|
|
7952
7952
|
if ("u" > typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" == typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE) try {
|
|
7953
7953
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e);
|
|
7954
7954
|
} catch (e) {
|
|
7955
7955
|
console.error(e);
|
|
7956
7956
|
}
|
|
7957
|
-
})(), e.exports = n(
|
|
7957
|
+
})(), e.exports = n(8844);
|
|
7958
7958
|
},
|
|
7959
|
-
|
|
7959
|
+
5448 (e, t) {
|
|
7960
7960
|
var n = Symbol.for("react.transitional.element");
|
|
7961
7961
|
function r(e, t, r) {
|
|
7962
7962
|
var l = null;
|
|
@@ -7972,7 +7972,7 @@
|
|
|
7972
7972
|
}
|
|
7973
7973
|
t.Fragment = Symbol.for("react.fragment"), t.jsx = r, t.jsxs = r;
|
|
7974
7974
|
},
|
|
7975
|
-
|
|
7975
|
+
2035 (e, t) {
|
|
7976
7976
|
var n = Symbol.for("react.transitional.element"), r = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), i = Symbol.for("react.consumer"), u = Symbol.for("react.context"), s = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), f = Symbol.for("react.memo"), d = Symbol.for("react.lazy"), p = Symbol.for("react.activity"), m = Symbol.iterator, h = {
|
|
7977
7977
|
isMounted: function() {
|
|
7978
7978
|
return !1;
|
|
@@ -8250,13 +8250,13 @@
|
|
|
8250
8250
|
return E.H.useSyncExternalStore(e, t, n);
|
|
8251
8251
|
}, t.useTransition = function() {
|
|
8252
8252
|
return E.H.useTransition();
|
|
8253
|
-
}, t.version = "19.2.
|
|
8253
|
+
}, t.version = "19.2.4";
|
|
8254
8254
|
},
|
|
8255
|
-
|
|
8256
|
-
e.exports = n(
|
|
8255
|
+
162 (e, t, n) {
|
|
8256
|
+
e.exports = n(2035);
|
|
8257
8257
|
},
|
|
8258
|
-
|
|
8259
|
-
e.exports = n(
|
|
8258
|
+
6730 (e, t, n) {
|
|
8259
|
+
e.exports = n(5448);
|
|
8260
8260
|
},
|
|
8261
8261
|
7146 (e, t) {
|
|
8262
8262
|
function n(e, t) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! For license information please see lib-react.97ee79b0.js.LICENSE.txt */
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
(()=>{
|
|
2
|
+
"use strict";
|
|
3
|
+
function e(e) {
|
|
4
|
+
return e;
|
|
5
|
+
}
|
|
6
|
+
let { clearTimeout: t, setTimeout: a } = globalThis, r = Math.random.bind(Math), i = async (e, t, a)=>{
|
|
7
|
+
if (!e || null === a || "function" != typeof a.postMessage) return;
|
|
8
|
+
let r = (e)=>{
|
|
9
|
+
a.postMessage({
|
|
10
|
+
type: "__rstest_snapshot_response__",
|
|
11
|
+
payload: e
|
|
12
|
+
}, "*");
|
|
13
|
+
};
|
|
14
|
+
try {
|
|
15
|
+
let a;
|
|
16
|
+
switch(t.method){
|
|
17
|
+
case "resolveSnapshotPath":
|
|
18
|
+
a = await e.resolveSnapshotPath(t.args.testPath);
|
|
19
|
+
break;
|
|
20
|
+
case "readSnapshotFile":
|
|
21
|
+
a = await e.readSnapshotFile(t.args.filepath);
|
|
22
|
+
break;
|
|
23
|
+
case "saveSnapshotFile":
|
|
24
|
+
a = await e.saveSnapshotFile(t.args.filepath, t.args.content);
|
|
25
|
+
break;
|
|
26
|
+
case "removeSnapshotFile":
|
|
27
|
+
a = await e.removeSnapshotFile(t.args.filepath);
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
a = void 0;
|
|
31
|
+
}
|
|
32
|
+
r({
|
|
33
|
+
id: t.id,
|
|
34
|
+
result: a
|
|
35
|
+
});
|
|
36
|
+
} catch (e) {
|
|
37
|
+
r({
|
|
38
|
+
id: t.id,
|
|
39
|
+
error: e instanceof Error ? e.message : String(e)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}, l = [
|
|
43
|
+
1e3,
|
|
44
|
+
2e3,
|
|
45
|
+
4e3,
|
|
46
|
+
8e3,
|
|
47
|
+
16e3,
|
|
48
|
+
3e4
|
|
49
|
+
], o = function(e, t, a) {
|
|
50
|
+
let r = arguments.length > 3 && void 0 !== arguments[3] && arguments[3], i = new URL("/runner.html", t || window.location.origin);
|
|
51
|
+
return i.searchParams.set("testFile", e), a && i.searchParams.set("testNamePattern", a), r && i.searchParams.set("t", Date.now().toString()), i.toString();
|
|
52
|
+
}, n = [
|
|
53
|
+
{
|
|
54
|
+
id: "iPhoneSE",
|
|
55
|
+
label: "iPhone SE",
|
|
56
|
+
width: 375,
|
|
57
|
+
height: 667
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "iPhoneXR",
|
|
61
|
+
label: "iPhone XR",
|
|
62
|
+
width: 414,
|
|
63
|
+
height: 896
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "iPhone12Pro",
|
|
67
|
+
label: "iPhone 12 Pro",
|
|
68
|
+
width: 390,
|
|
69
|
+
height: 844
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "iPhone14ProMax",
|
|
73
|
+
label: "iPhone 14 Pro Max",
|
|
74
|
+
width: 430,
|
|
75
|
+
height: 932
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "Pixel7",
|
|
79
|
+
label: "Pixel 7",
|
|
80
|
+
width: 412,
|
|
81
|
+
height: 915
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "SamsungGalaxyS8Plus",
|
|
85
|
+
label: "Samsung Galaxy S8+",
|
|
86
|
+
width: 360,
|
|
87
|
+
height: 740
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "SamsungGalaxyS20Ultra",
|
|
91
|
+
label: "Samsung Galaxy S20 Ultra",
|
|
92
|
+
width: 412,
|
|
93
|
+
height: 915
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "iPadMini",
|
|
97
|
+
label: "iPad Mini",
|
|
98
|
+
width: 768,
|
|
99
|
+
height: 1024
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "iPadAir",
|
|
103
|
+
label: "iPad Air",
|
|
104
|
+
width: 820,
|
|
105
|
+
height: 1180
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: "iPadPro",
|
|
109
|
+
label: "iPad Pro",
|
|
110
|
+
width: 1024,
|
|
111
|
+
height: 1366
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: "SurfacePro7",
|
|
115
|
+
label: "Surface Pro 7",
|
|
116
|
+
width: 912,
|
|
117
|
+
height: 1368
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "SurfaceDuo",
|
|
121
|
+
label: "Surface Duo",
|
|
122
|
+
width: 540,
|
|
123
|
+
height: 720
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: "GalaxyZFold5",
|
|
127
|
+
label: "Galaxy Z Fold 5",
|
|
128
|
+
width: 344,
|
|
129
|
+
height: 882
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: "AsusZenbookFold",
|
|
133
|
+
label: "Asus Zenbook Fold",
|
|
134
|
+
width: 853,
|
|
135
|
+
height: 1280
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: "SamsungGalaxyA51A71",
|
|
139
|
+
label: "Samsung Galaxy A51/71",
|
|
140
|
+
width: 412,
|
|
141
|
+
height: 914
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "NestHub",
|
|
145
|
+
label: "Nest Hub",
|
|
146
|
+
width: 1024,
|
|
147
|
+
height: 600
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: "NestHubMax",
|
|
151
|
+
label: "Nest Hub Max",
|
|
152
|
+
width: 1280,
|
|
153
|
+
height: 800
|
|
154
|
+
}
|
|
155
|
+
], s = new Set(n.map((e)=>e.id)), h = window.__RSTEST_BROWSER_OPTIONS__, c = (null == h ? void 0 : h.debug) === !0, d = (null == h ? void 0 : h.rpcTimeout) ?? 3e4, u = null, w = 0, p = null, f = new Map, g = new Map, y = function() {
|
|
156
|
+
for(var e = arguments.length, t = Array(e), a = 0; a < e; a++)t[a] = arguments[a];
|
|
157
|
+
c && console.log("[Scheduler]", ...t);
|
|
158
|
+
}, m = (e, t)=>{
|
|
159
|
+
let a = f.get(e);
|
|
160
|
+
a || ((a = document.createElement("iframe")).style.position = "fixed", a.style.left = "0", a.style.top = "0", a.style.opacity = "0", a.style.pointerEvents = "none", a.style.border = "0", a.title = `Scheduler runner for ${e}`, a.dataset.testFile = e, a.addEventListener("load", ()=>{
|
|
161
|
+
var t, r;
|
|
162
|
+
let i;
|
|
163
|
+
t = a, i = g.get(e) || "", null == (r = t.contentWindow) || r.postMessage({
|
|
164
|
+
type: "RSTEST_CONFIG",
|
|
165
|
+
payload: {
|
|
166
|
+
...h,
|
|
167
|
+
testFile: e,
|
|
168
|
+
projectName: i
|
|
169
|
+
}
|
|
170
|
+
}, "*");
|
|
171
|
+
}), document.body.appendChild(a), f.set(e, a));
|
|
172
|
+
let r = ((e)=>{
|
|
173
|
+
let t = g.get(e);
|
|
174
|
+
if (!t) return null;
|
|
175
|
+
let a = null == h ? void 0 : h.projects.find((e)=>e.name === t), r = null == a ? void 0 : a.viewport;
|
|
176
|
+
if (!r) return null;
|
|
177
|
+
if ("string" == typeof r && "string" == typeof r && s.has(r)) {
|
|
178
|
+
let e = ((e)=>{
|
|
179
|
+
let t = n.find((t)=>t.id === e);
|
|
180
|
+
if (!t) throw Error(`Unknown device preset: ${e}`);
|
|
181
|
+
return t;
|
|
182
|
+
})(r);
|
|
183
|
+
return {
|
|
184
|
+
width: e.width,
|
|
185
|
+
height: e.height
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
return "object" == typeof r && null !== r && "number" == typeof r.width && "number" == typeof r.height ? {
|
|
189
|
+
width: r.width,
|
|
190
|
+
height: r.height
|
|
191
|
+
} : null;
|
|
192
|
+
})(e);
|
|
193
|
+
r ? (a.style.width = `${r.width}px`, a.style.height = `${r.height}px`) : (a.style.width = "100vw", a.style.height = "100vh"), a.src = o(e, null == h ? void 0 : h.runnerUrl, t, !0);
|
|
194
|
+
}, b = (e)=>{
|
|
195
|
+
let t = new Set(g.keys()), a = new Set(e.map((e)=>e.testPath));
|
|
196
|
+
for (let [e, t] of f.entries())a.has(e) || (t.remove(), f.delete(e), g.delete(e));
|
|
197
|
+
for (let t of e)g.set(t.testPath, t.projectName);
|
|
198
|
+
for (let a of e.filter((e)=>!t.has(e.testPath)))m(a.testPath);
|
|
199
|
+
}, S = async (e)=>{
|
|
200
|
+
if (u) try {
|
|
201
|
+
switch(e.type){
|
|
202
|
+
case "file-start":
|
|
203
|
+
await u.onTestFileStart(e.payload);
|
|
204
|
+
break;
|
|
205
|
+
case "case-result":
|
|
206
|
+
await u.onTestCaseResult(e.payload);
|
|
207
|
+
break;
|
|
208
|
+
case "file-complete":
|
|
209
|
+
await u.onTestFileComplete(e.payload);
|
|
210
|
+
break;
|
|
211
|
+
case "log":
|
|
212
|
+
await u.onLog(e.payload);
|
|
213
|
+
break;
|
|
214
|
+
case "fatal":
|
|
215
|
+
await u.onFatal(e.payload);
|
|
216
|
+
}
|
|
217
|
+
} catch (e) {
|
|
218
|
+
y("failed to forward client message", e);
|
|
219
|
+
}
|
|
220
|
+
}, P = ()=>{
|
|
221
|
+
let e = l[Math.min(w, l.length - 1)];
|
|
222
|
+
w++, y(`reconnecting in ${e}ms`), p = setTimeout(()=>{
|
|
223
|
+
v().catch((e)=>{
|
|
224
|
+
y("reconnect attempt failed", e instanceof Error ? e.message : String(e)), P();
|
|
225
|
+
});
|
|
226
|
+
}, e);
|
|
227
|
+
}, v = async ()=>{
|
|
228
|
+
var i;
|
|
229
|
+
let l;
|
|
230
|
+
if (!(null == h ? void 0 : h.wsPort)) throw Error("Scheduler requires wsPort in browser options.");
|
|
231
|
+
p && (clearTimeout(p), p = null);
|
|
232
|
+
let o = new WebSocket((i = h.wsPort, l = "https:" === window.location.protocol ? "wss:" : "ws:", `${l}//${window.location.hostname}:${i}`));
|
|
233
|
+
await new Promise((e, t)=>{
|
|
234
|
+
let a = setTimeout(()=>{
|
|
235
|
+
t(Error(`Scheduler websocket timeout after ${d}ms`));
|
|
236
|
+
}, d);
|
|
237
|
+
o.addEventListener("open", ()=>{
|
|
238
|
+
clearTimeout(a), e();
|
|
239
|
+
}), o.addEventListener("error", ()=>{
|
|
240
|
+
clearTimeout(a), t(Error("Scheduler websocket failed to connect."));
|
|
241
|
+
});
|
|
242
|
+
}), w = 0, u = function(i, l) {
|
|
243
|
+
let o, n, { post: s, on: h, off: c = ()=>{}, eventNames: d = [], serialize: u = e, deserialize: w = e, resolver: p, bind: f = "rpc", timeout: g = 6e4 } = l, y = !1, m = new Map;
|
|
244
|
+
async function b(e, i, h, c) {
|
|
245
|
+
let d, w, p;
|
|
246
|
+
if (y) throw Error(`[birpc] rpc is closed, cannot call "${e}"`);
|
|
247
|
+
let f = {
|
|
248
|
+
m: e,
|
|
249
|
+
a: i,
|
|
250
|
+
t: "q"
|
|
251
|
+
};
|
|
252
|
+
c && (f.o = !0);
|
|
253
|
+
let b = async (e)=>s(u(e));
|
|
254
|
+
if (h) return void await b(f);
|
|
255
|
+
if (o) try {
|
|
256
|
+
await o;
|
|
257
|
+
} finally{
|
|
258
|
+
o = void 0;
|
|
259
|
+
}
|
|
260
|
+
let { promise: S, resolve: P, reject: v } = {
|
|
261
|
+
promise: new Promise((e, t)=>{
|
|
262
|
+
w = e, p = t;
|
|
263
|
+
}),
|
|
264
|
+
resolve: w,
|
|
265
|
+
reject: p
|
|
266
|
+
}, E = function(e = 21) {
|
|
267
|
+
let t = "", a = e;
|
|
268
|
+
for(; a--;)t += "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64 * r() | 0];
|
|
269
|
+
return t;
|
|
270
|
+
}();
|
|
271
|
+
async function F(t = f) {
|
|
272
|
+
return g >= 0 && "object" == typeof (d = a(()=>{
|
|
273
|
+
try {
|
|
274
|
+
let t = l.onTimeoutError?.call(n, e, i);
|
|
275
|
+
if (!0 !== t) throw Error(`[birpc] timeout on calling "${e}"`);
|
|
276
|
+
} catch (e) {
|
|
277
|
+
v(e);
|
|
278
|
+
}
|
|
279
|
+
m.delete(E);
|
|
280
|
+
}, g)) && (d = d.unref?.()), m.set(E, {
|
|
281
|
+
resolve: P,
|
|
282
|
+
reject: v,
|
|
283
|
+
timeoutId: d,
|
|
284
|
+
method: e
|
|
285
|
+
}), await b(t), S;
|
|
286
|
+
}
|
|
287
|
+
f.i = E;
|
|
288
|
+
try {
|
|
289
|
+
l.onRequest ? await l.onRequest.call(n, f, F, P) : await F();
|
|
290
|
+
} catch (e) {
|
|
291
|
+
if (l.onGeneralError?.call(n, e) !== !0) throw e;
|
|
292
|
+
return;
|
|
293
|
+
} finally{
|
|
294
|
+
t(d), m.delete(E);
|
|
295
|
+
}
|
|
296
|
+
return S;
|
|
297
|
+
}
|
|
298
|
+
let S = {
|
|
299
|
+
$call: (e, ...t)=>b(e, t, !1),
|
|
300
|
+
$callOptional: (e, ...t)=>b(e, t, !1, !0),
|
|
301
|
+
$callEvent: (e, ...t)=>b(e, t, !0),
|
|
302
|
+
$callRaw: (e)=>b(e.method, e.args, e.event, e.optional),
|
|
303
|
+
$rejectPendingCalls: function(e) {
|
|
304
|
+
let t = Array.from(m.values()).map(({ method: t, reject: a })=>e ? e({
|
|
305
|
+
method: t,
|
|
306
|
+
reject: a
|
|
307
|
+
}) : a(Error(`[birpc]: rejected pending call "${t}".`)));
|
|
308
|
+
return m.clear(), t;
|
|
309
|
+
},
|
|
310
|
+
get $closed () {
|
|
311
|
+
return y;
|
|
312
|
+
},
|
|
313
|
+
get $meta () {
|
|
314
|
+
return l.meta;
|
|
315
|
+
},
|
|
316
|
+
$close: function(e) {
|
|
317
|
+
y = !0, m.forEach(({ reject: t, method: a })=>{
|
|
318
|
+
let r = Error(`[birpc] rpc is closed, cannot call "${a}"`);
|
|
319
|
+
if (e) return e.cause ??= r, t(e);
|
|
320
|
+
t(r);
|
|
321
|
+
}), m.clear(), c(P);
|
|
322
|
+
},
|
|
323
|
+
$functions: i
|
|
324
|
+
};
|
|
325
|
+
async function P(e, ...a) {
|
|
326
|
+
let r;
|
|
327
|
+
try {
|
|
328
|
+
r = w(e);
|
|
329
|
+
} catch (e) {
|
|
330
|
+
if (l.onGeneralError?.call(n, e) !== !0) throw e;
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
if ("q" === r.t) {
|
|
334
|
+
let e, t, { m: o, a: h, o: c } = r, d = await (p ? p.call(n, o, i[o]) : i[o]);
|
|
335
|
+
if (c && (d ||= ()=>void 0), d) try {
|
|
336
|
+
e = await d.apply("rpc" === f ? n : i, h);
|
|
337
|
+
} catch (e) {
|
|
338
|
+
t = e;
|
|
339
|
+
}
|
|
340
|
+
else t = Error(`[birpc] function "${o}" not found`);
|
|
341
|
+
if (r.i) {
|
|
342
|
+
if (t && l.onError && l.onError.call(n, t, o, h), t && l.onFunctionError && !0 === l.onFunctionError.call(n, t, o, h)) return;
|
|
343
|
+
if (!t) try {
|
|
344
|
+
await s(u({
|
|
345
|
+
t: "s",
|
|
346
|
+
i: r.i,
|
|
347
|
+
r: e
|
|
348
|
+
}), ...a);
|
|
349
|
+
return;
|
|
350
|
+
} catch (e) {
|
|
351
|
+
if (t = e, l.onGeneralError?.call(n, e, o, h) !== !0) throw e;
|
|
352
|
+
}
|
|
353
|
+
try {
|
|
354
|
+
await s(u({
|
|
355
|
+
t: "s",
|
|
356
|
+
i: r.i,
|
|
357
|
+
e: t
|
|
358
|
+
}), ...a);
|
|
359
|
+
} catch (e) {
|
|
360
|
+
if (l.onGeneralError?.call(n, e, o, h) !== !0) throw e;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
} else {
|
|
364
|
+
let { i: e, r: a, e: i } = r, l = m.get(e);
|
|
365
|
+
l && (t(l.timeoutId), i ? l.reject(i) : l.resolve(a)), m.delete(e);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return n = new Proxy({}, {
|
|
369
|
+
get (e, t) {
|
|
370
|
+
if (Object.prototype.hasOwnProperty.call(S, t)) return S[t];
|
|
371
|
+
if ("then" === t && !d.includes("then") && !("then" in i)) return;
|
|
372
|
+
let a = (...e)=>b(t, e, !0);
|
|
373
|
+
if (d.includes(t)) return a.asEvent = a, a;
|
|
374
|
+
let r = (...e)=>b(t, e, !1);
|
|
375
|
+
return r.asEvent = a, r;
|
|
376
|
+
}
|
|
377
|
+
}), o = h(P), n;
|
|
378
|
+
}({
|
|
379
|
+
onTestFileUpdate (e) {
|
|
380
|
+
y("onTestFileUpdate", e.length), b(e);
|
|
381
|
+
},
|
|
382
|
+
reloadTestFile (e, t) {
|
|
383
|
+
y("reloadTestFile", e, t), m(e, t);
|
|
384
|
+
}
|
|
385
|
+
}, {
|
|
386
|
+
timeout: d,
|
|
387
|
+
post (e) {
|
|
388
|
+
o.readyState === WebSocket.OPEN && o.send(JSON.stringify(e));
|
|
389
|
+
},
|
|
390
|
+
on (e) {
|
|
391
|
+
o.addEventListener("message", (t)=>{
|
|
392
|
+
try {
|
|
393
|
+
e(JSON.parse(String(t.data)));
|
|
394
|
+
} catch {}
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
}), o.addEventListener("close", ()=>{
|
|
398
|
+
y("websocket closed"), u = null, P();
|
|
399
|
+
}), b(await u.getTestFiles());
|
|
400
|
+
};
|
|
401
|
+
window.addEventListener("message", (e)=>{
|
|
402
|
+
var t;
|
|
403
|
+
let a = (null == (t = e.data) ? void 0 : t.type) !== "__rstest_dispatch__" ? null : e.data.payload;
|
|
404
|
+
if (a) {
|
|
405
|
+
if ("snapshot-rpc-request" === a.type) return void i(u, a.payload, e.source);
|
|
406
|
+
S(a);
|
|
407
|
+
}
|
|
408
|
+
}), v().catch((e)=>{
|
|
409
|
+
console.error("[Scheduler] Failed to initialize:", e instanceof Error ? e.message : String(e)), P();
|
|
410
|
+
});
|
|
411
|
+
})();
|
|
@@ -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.
|
|
15
|
+
<script defer src="/container-static/js/lib-react.97ee79b0.js"></script><script defer src="/container-static/js/392.28f9a733.js"></script><script defer src="/container-static/js/index.129eaf9c.js"></script><link href="/container-static/css/index.5a71c757.css" rel="stylesheet"></head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="root"></div>
|
|
18
18
|
</body>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link
|
|
7
|
+
rel="icon"
|
|
8
|
+
type="image/svg+xml"
|
|
9
|
+
href="https://assets.rspack.rs/rstest/rstest-logo.svg"
|
|
10
|
+
/>
|
|
11
|
+
<title>Rstest Browser Test Runner</title>
|
|
12
|
+
<script>
|
|
13
|
+
window.__RSTEST_BROWSER_OPTIONS__ = __RSTEST_OPTIONS_PLACEHOLDER__;
|
|
14
|
+
</script>
|
|
15
|
+
<script defer src="/container-static/js/scheduler.6976de44.js"></script></head>
|
|
16
|
+
<body>
|
|
17
|
+
<div id="root"></div>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { BrowserTestRunOptions, BrowserTestRunResult, Rstest } from '@rstest/core/browser';
|
|
2
2
|
import { type ListBrowserTestsResult } from './hostController';
|
|
3
|
+
export { validateBrowserConfig } from './configValidation';
|
|
4
|
+
export { BROWSER_VIEWPORT_PRESET_DIMENSIONS, BROWSER_VIEWPORT_PRESET_IDS, resolveBrowserViewportPreset, } from './viewportPresets';
|
|
3
5
|
export declare function runBrowserTests(context: Rstest, options?: BrowserTestRunOptions): Promise<BrowserTestRunResult | void>;
|
|
4
6
|
export declare function listBrowserTests(context: Rstest): Promise<ListBrowserTestsResult>;
|
|
5
7
|
export type { BrowserTestRunOptions, BrowserTestRunResult, ListBrowserTestsResult, };
|