@rstest/browser 0.8.4 → 0.8.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/{392.28f9a733.js → 565.226c9ef5.js} +50 -54
- package/dist/browser-container/container-static/js/565.226c9ef5.js.LICENSE.txt +1 -0
- package/dist/browser-container/container-static/js/{index.129eaf9c.js → index.c1d17467.js} +3 -3
- package/dist/browser-container/container-static/js/{scheduler.6976de44.js → scheduler.5accca0c.js} +58 -62
- package/dist/browser-container/index.html +1 -1
- package/dist/browser-container/scheduler.html +1 -1
- package/dist/index.js +33 -43
- package/package.json +4 -4
- package/src/client/entry.ts +13 -6
- package/dist/browser-container/container-static/js/392.28f9a733.js.LICENSE.txt +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! For license information please see
|
|
2
|
-
/*! For license information please see
|
|
1
|
+
/*! For license information please see 565.226c9ef5.js.LICENSE.txt */
|
|
2
|
+
/*! For license information please see 565.226c9ef5.js.LICENSE.txt */ "use strict";
|
|
3
3
|
(self.webpackChunk_rstest_browser_ui = self.webpackChunk_rstest_browser_ui || []).push([
|
|
4
4
|
[
|
|
5
|
-
"
|
|
5
|
+
"565"
|
|
6
6
|
],
|
|
7
7
|
{
|
|
8
8
|
6888 (e, t, r) {
|
|
@@ -26757,27 +26757,24 @@ html body {
|
|
|
26757
26757
|
}
|
|
26758
26758
|
}
|
|
26759
26759
|
},
|
|
26760
|
-
|
|
26761
|
-
function n(e) {
|
|
26762
|
-
return e;
|
|
26763
|
-
}
|
|
26760
|
+
5999 (e, t, r) {
|
|
26764
26761
|
r.d(t, {
|
|
26765
|
-
|
|
26762
|
+
L: ()=>l
|
|
26766
26763
|
});
|
|
26767
|
-
let { clearTimeout:
|
|
26764
|
+
let n = Math.random.bind(Math), o = (e)=>e, { clearTimeout: a, setTimeout: i } = globalThis;
|
|
26768
26765
|
function l(e, t) {
|
|
26769
|
-
let r, l, { post: s, on: c, off: u = ()=>{}, eventNames: d = [], serialize: f =
|
|
26770
|
-
async function
|
|
26766
|
+
let r, l, { post: s, on: c, off: u = ()=>{}, eventNames: d = [], serialize: f = o, deserialize: p = o, resolver: m, bind: h = "rpc", timeout: g = 6e4, proxify: b = !0 } = t, v = !1, y = new Map;
|
|
26767
|
+
async function $(e, o, c, u) {
|
|
26771
26768
|
let d, p, m;
|
|
26772
|
-
if (
|
|
26769
|
+
if (v) throw Error(`[birpc] rpc is closed, cannot call "${e}"`);
|
|
26773
26770
|
let h = {
|
|
26774
26771
|
m: e,
|
|
26775
|
-
a:
|
|
26772
|
+
a: o,
|
|
26776
26773
|
t: "q"
|
|
26777
26774
|
};
|
|
26778
26775
|
u && (h.o = !0);
|
|
26779
|
-
let
|
|
26780
|
-
if (c) return void await
|
|
26776
|
+
let b = async (e)=>s(f(e));
|
|
26777
|
+
if (c) return void await b(h);
|
|
26781
26778
|
if (r) try {
|
|
26782
26779
|
await r;
|
|
26783
26780
|
} finally{
|
|
@@ -26791,24 +26788,23 @@ html body {
|
|
|
26791
26788
|
reject: m
|
|
26792
26789
|
}, E = function(e = 21) {
|
|
26793
26790
|
let t = "", r = e;
|
|
26794
|
-
for(; r--;)t += "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64 *
|
|
26791
|
+
for(; r--;)t += "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64 * n() | 0];
|
|
26795
26792
|
return t;
|
|
26796
26793
|
}();
|
|
26797
26794
|
async function k(r = h) {
|
|
26798
|
-
return g >= 0 && "object" == typeof (d =
|
|
26795
|
+
return g >= 0 && "object" == typeof (d = i(()=>{
|
|
26799
26796
|
try {
|
|
26800
|
-
|
|
26801
|
-
if (!0 !== r) throw Error(`[birpc] timeout on calling "${e}"`);
|
|
26797
|
+
if (t.onTimeoutError?.call(l, e, o) !== !0) throw Error(`[birpc] timeout on calling "${e}"`);
|
|
26802
26798
|
} catch (e) {
|
|
26803
26799
|
w(e);
|
|
26804
26800
|
}
|
|
26805
|
-
|
|
26806
|
-
}, g)) && (d = d.unref?.()),
|
|
26801
|
+
y.delete(E);
|
|
26802
|
+
}, g)) && (d = d.unref?.()), y.set(E, {
|
|
26807
26803
|
resolve: x,
|
|
26808
26804
|
reject: w,
|
|
26809
26805
|
timeoutId: d,
|
|
26810
26806
|
method: e
|
|
26811
|
-
}), await
|
|
26807
|
+
}), await b(r), $;
|
|
26812
26808
|
}
|
|
26813
26809
|
h.i = E;
|
|
26814
26810
|
try {
|
|
@@ -26817,90 +26813,90 @@ html body {
|
|
|
26817
26813
|
if (t.onGeneralError?.call(l, e) !== !0) throw e;
|
|
26818
26814
|
return;
|
|
26819
26815
|
} finally{
|
|
26820
|
-
|
|
26816
|
+
a(d), y.delete(E);
|
|
26821
26817
|
}
|
|
26822
26818
|
return $;
|
|
26823
26819
|
}
|
|
26824
|
-
let
|
|
26825
|
-
$call: (e, ...t)
|
|
26826
|
-
$callOptional: (e, ...t)
|
|
26827
|
-
$callEvent: (e, ...t)
|
|
26828
|
-
$callRaw: (e)
|
|
26820
|
+
let x = {
|
|
26821
|
+
$call: (e, ...t)=>$(e, t, !1),
|
|
26822
|
+
$callOptional: (e, ...t)=>$(e, t, !1, !0),
|
|
26823
|
+
$callEvent: (e, ...t)=>$(e, t, !0),
|
|
26824
|
+
$callRaw: (e)=>$(e.method, e.args, e.event, e.optional),
|
|
26829
26825
|
$rejectPendingCalls: function(e) {
|
|
26830
|
-
let t = Array.from(
|
|
26826
|
+
let t = Array.from(y.values()).map(({ method: t, reject: r })=>e ? e({
|
|
26831
26827
|
method: t,
|
|
26832
26828
|
reject: r
|
|
26833
26829
|
}) : r(Error(`[birpc]: rejected pending call "${t}".`)));
|
|
26834
|
-
return
|
|
26830
|
+
return y.clear(), t;
|
|
26835
26831
|
},
|
|
26836
26832
|
get $closed () {
|
|
26837
|
-
return
|
|
26833
|
+
return v;
|
|
26838
26834
|
},
|
|
26839
26835
|
get $meta () {
|
|
26840
26836
|
return t.meta;
|
|
26841
26837
|
},
|
|
26842
26838
|
$close: function(e) {
|
|
26843
|
-
|
|
26839
|
+
v = !0, y.forEach(({ reject: t, method: r })=>{
|
|
26844
26840
|
let n = Error(`[birpc] rpc is closed, cannot call "${r}"`);
|
|
26845
26841
|
if (e) return e.cause ??= n, t(e);
|
|
26846
26842
|
t(n);
|
|
26847
|
-
}),
|
|
26843
|
+
}), y.clear(), u(w);
|
|
26848
26844
|
},
|
|
26849
26845
|
$functions: e
|
|
26850
26846
|
};
|
|
26851
|
-
async function
|
|
26852
|
-
let
|
|
26847
|
+
async function w(r, ...n) {
|
|
26848
|
+
let o;
|
|
26853
26849
|
try {
|
|
26854
|
-
|
|
26850
|
+
o = p(r);
|
|
26855
26851
|
} catch (e) {
|
|
26856
26852
|
if (t.onGeneralError?.call(l, e) !== !0) throw e;
|
|
26857
26853
|
return;
|
|
26858
26854
|
}
|
|
26859
|
-
if ("q" ===
|
|
26860
|
-
let r,
|
|
26855
|
+
if ("q" === o.t) {
|
|
26856
|
+
let r, a, { m: i, a: c, o: u } = o, d = await (m ? m.call(l, i, e[i]) : e[i]);
|
|
26861
26857
|
if (u && (d ||= ()=>void 0), d) try {
|
|
26862
26858
|
r = await d.apply("rpc" === h ? l : e, c);
|
|
26863
26859
|
} catch (e) {
|
|
26864
|
-
|
|
26860
|
+
a = e;
|
|
26865
26861
|
}
|
|
26866
|
-
else
|
|
26867
|
-
if (
|
|
26868
|
-
if (
|
|
26869
|
-
if (!
|
|
26862
|
+
else a = Error(`[birpc] function "${i}" not found`);
|
|
26863
|
+
if (o.i) {
|
|
26864
|
+
if (a && t.onFunctionError && !0 === t.onFunctionError.call(l, a, i, c)) return;
|
|
26865
|
+
if (!a) try {
|
|
26870
26866
|
await s(f({
|
|
26871
26867
|
t: "s",
|
|
26872
|
-
i:
|
|
26868
|
+
i: o.i,
|
|
26873
26869
|
r: r
|
|
26874
26870
|
}), ...n);
|
|
26875
26871
|
return;
|
|
26876
26872
|
} catch (e) {
|
|
26877
|
-
if (
|
|
26873
|
+
if (a = e, t.onGeneralError?.call(l, e, i, c) !== !0) throw e;
|
|
26878
26874
|
}
|
|
26879
26875
|
try {
|
|
26880
26876
|
await s(f({
|
|
26881
26877
|
t: "s",
|
|
26882
|
-
i:
|
|
26883
|
-
e:
|
|
26878
|
+
i: o.i,
|
|
26879
|
+
e: a
|
|
26884
26880
|
}), ...n);
|
|
26885
26881
|
} catch (e) {
|
|
26886
26882
|
if (t.onGeneralError?.call(l, e, i, c) !== !0) throw e;
|
|
26887
26883
|
}
|
|
26888
26884
|
}
|
|
26889
26885
|
} else {
|
|
26890
|
-
let { i: e, r: t, e: r } =
|
|
26891
|
-
n && (
|
|
26886
|
+
let { i: e, r: t, e: r } = o, n = y.get(e);
|
|
26887
|
+
n && (a(n.timeoutId), r ? n.reject(r) : n.resolve(t)), y.delete(e);
|
|
26892
26888
|
}
|
|
26893
26889
|
}
|
|
26894
|
-
return l = new Proxy({}, {
|
|
26890
|
+
return l = b ? new Proxy({}, {
|
|
26895
26891
|
get (t, r) {
|
|
26896
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
26892
|
+
if (Object.prototype.hasOwnProperty.call(x, r)) return x[r];
|
|
26897
26893
|
if ("then" === r && !d.includes("then") && !("then" in e)) return;
|
|
26898
|
-
let n = (...e)
|
|
26894
|
+
let n = (...e)=>$(r, e, !0);
|
|
26899
26895
|
if (d.includes(r)) return n.asEvent = n, n;
|
|
26900
|
-
let o = (...e)
|
|
26896
|
+
let o = (...e)=>$(r, e, !1);
|
|
26901
26897
|
return o.asEvent = n, o;
|
|
26902
26898
|
}
|
|
26903
|
-
}), r = c(
|
|
26899
|
+
}) : x, r = c(w), l;
|
|
26904
26900
|
}
|
|
26905
26901
|
},
|
|
26906
26902
|
851 (e, t, r) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! For license information please see 565.226c9ef5.js.LICENSE.txt */
|
|
@@ -2291,7 +2291,7 @@
|
|
|
2291
2291
|
let l = arguments.length > 3 && void 0 !== arguments[3] && arguments[3], o = new URL("/runner.html", t || window.location.origin);
|
|
2292
2292
|
return o.searchParams.set("testFile", e), s && o.searchParams.set("testNamePattern", s), l && o.searchParams.set("t", Date.now().toString()), o.toString();
|
|
2293
2293
|
};
|
|
2294
|
-
var ev = s(
|
|
2294
|
+
var ev = s(5999);
|
|
2295
2295
|
let ey = function() {
|
|
2296
2296
|
for(var e, t = arguments.length, s = Array(t), l = 0; l < t; l++)s[l] = arguments[l];
|
|
2297
2297
|
(null == (e = window.__RSTEST_BROWSER_OPTIONS__) ? void 0 : e.debug) === !0 && console.log(...s);
|
|
@@ -2410,7 +2410,7 @@
|
|
|
2410
2410
|
e.onopen = ()=>{
|
|
2411
2411
|
if (!a || !e) return;
|
|
2412
2412
|
ey("[Container] WebSocket connected"), s = 0, c(!0);
|
|
2413
|
-
let t = (0, ev.
|
|
2413
|
+
let t = (0, ev.L)(u, {
|
|
2414
2414
|
post: (t)=>{
|
|
2415
2415
|
(null == e ? void 0 : e.readyState) === WebSocket.OPEN && e.send(JSON.stringify(t));
|
|
2416
2416
|
},
|
|
@@ -2941,7 +2941,7 @@
|
|
|
2941
2941
|
}, (a = self.webpackChunk_rstest_browser_ui = self.webpackChunk_rstest_browser_ui || []).forEach(o.bind(null, 0)), a.push = o.bind(null, a.push.bind(a));
|
|
2942
2942
|
var c = n.O(void 0, [
|
|
2943
2943
|
"783",
|
|
2944
|
-
"
|
|
2944
|
+
"565"
|
|
2945
2945
|
], ()=>n(2976));
|
|
2946
2946
|
c = n.O(c);
|
|
2947
2947
|
})();
|
package/dist/browser-container/container-static/js/{scheduler.6976de44.js → scheduler.5accca0c.js}
RENAMED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
(()=>{
|
|
2
2
|
"use strict";
|
|
3
|
-
|
|
4
|
-
return e;
|
|
5
|
-
}
|
|
6
|
-
let { clearTimeout: t, setTimeout: a } = globalThis, r = Math.random.bind(Math), i = async (e, t, a)=>{
|
|
3
|
+
let e = Math.random.bind(Math), t = (e)=>e, { clearTimeout: a, setTimeout: r } = globalThis, i = async (e, t, a)=>{
|
|
7
4
|
if (!e || null === a || "function" != typeof a.postMessage) return;
|
|
8
5
|
let r = (e)=>{
|
|
9
6
|
a.postMessage({
|
|
@@ -152,9 +149,9 @@
|
|
|
152
149
|
width: 1280,
|
|
153
150
|
height: 800
|
|
154
151
|
}
|
|
155
|
-
], s = new Set(n.map((e)=>e.id)), h = window.__RSTEST_BROWSER_OPTIONS__,
|
|
152
|
+
], s = new Set(n.map((e)=>e.id)), h = window.__RSTEST_BROWSER_OPTIONS__, d = (null == h ? void 0 : h.debug) === !0, c = (null == h ? void 0 : h.rpcTimeout) ?? 3e4, u = null, w = 0, p = null, f = new Map, g = new Map, y = function() {
|
|
156
153
|
for(var e = arguments.length, t = Array(e), a = 0; a < e; a++)t[a] = arguments[a];
|
|
157
|
-
|
|
154
|
+
d && console.log("[Scheduler]", ...t);
|
|
158
155
|
}, m = (e, t)=>{
|
|
159
156
|
let a = f.get(e);
|
|
160
157
|
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", ()=>{
|
|
@@ -232,26 +229,26 @@
|
|
|
232
229
|
let o = new WebSocket((i = h.wsPort, l = "https:" === window.location.protocol ? "wss:" : "ws:", `${l}//${window.location.hostname}:${i}`));
|
|
233
230
|
await new Promise((e, t)=>{
|
|
234
231
|
let a = setTimeout(()=>{
|
|
235
|
-
t(Error(`Scheduler websocket timeout after ${
|
|
236
|
-
},
|
|
232
|
+
t(Error(`Scheduler websocket timeout after ${c}ms`));
|
|
233
|
+
}, c);
|
|
237
234
|
o.addEventListener("open", ()=>{
|
|
238
235
|
clearTimeout(a), e();
|
|
239
236
|
}), o.addEventListener("error", ()=>{
|
|
240
237
|
clearTimeout(a), t(Error("Scheduler websocket failed to connect."));
|
|
241
238
|
});
|
|
242
239
|
}), w = 0, u = function(i, l) {
|
|
243
|
-
let o, n, { post: s, on: h, off:
|
|
244
|
-
async function
|
|
245
|
-
let
|
|
246
|
-
if (
|
|
240
|
+
let o, n, { post: s, on: h, off: d = ()=>{}, eventNames: c = [], serialize: u = t, deserialize: w = t, resolver: p, bind: f = "rpc", timeout: g = 6e4, proxify: y = !0 } = l, m = !1, b = new Map;
|
|
241
|
+
async function S(t, i, h, d) {
|
|
242
|
+
let c, w, p;
|
|
243
|
+
if (m) throw Error(`[birpc] rpc is closed, cannot call "${t}"`);
|
|
247
244
|
let f = {
|
|
248
|
-
m:
|
|
245
|
+
m: t,
|
|
249
246
|
a: i,
|
|
250
247
|
t: "q"
|
|
251
248
|
};
|
|
252
|
-
|
|
253
|
-
let
|
|
254
|
-
if (h) return void await
|
|
249
|
+
d && (f.o = !0);
|
|
250
|
+
let y = async (e)=>s(u(e));
|
|
251
|
+
if (h) return void await y(f);
|
|
255
252
|
if (o) try {
|
|
256
253
|
await o;
|
|
257
254
|
} finally{
|
|
@@ -263,26 +260,25 @@
|
|
|
263
260
|
}),
|
|
264
261
|
resolve: w,
|
|
265
262
|
reject: p
|
|
266
|
-
}, E = function(
|
|
267
|
-
let
|
|
268
|
-
for(;
|
|
269
|
-
return
|
|
263
|
+
}, E = function(t = 21) {
|
|
264
|
+
let a = "", r = t;
|
|
265
|
+
for(; r--;)a += "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64 * e() | 0];
|
|
266
|
+
return a;
|
|
270
267
|
}();
|
|
271
|
-
async function F(
|
|
272
|
-
return g >= 0 && "object" == typeof (
|
|
268
|
+
async function F(e = f) {
|
|
269
|
+
return g >= 0 && "object" == typeof (c = r(()=>{
|
|
273
270
|
try {
|
|
274
|
-
|
|
275
|
-
if (!0 !== t) throw Error(`[birpc] timeout on calling "${e}"`);
|
|
271
|
+
if (l.onTimeoutError?.call(n, t, i) !== !0) throw Error(`[birpc] timeout on calling "${t}"`);
|
|
276
272
|
} catch (e) {
|
|
277
273
|
v(e);
|
|
278
274
|
}
|
|
279
|
-
|
|
280
|
-
}, g)) && (
|
|
275
|
+
b.delete(E);
|
|
276
|
+
}, g)) && (c = c.unref?.()), b.set(E, {
|
|
281
277
|
resolve: P,
|
|
282
278
|
reject: v,
|
|
283
|
-
timeoutId:
|
|
284
|
-
method:
|
|
285
|
-
}), await
|
|
279
|
+
timeoutId: c,
|
|
280
|
+
method: t
|
|
281
|
+
}), await y(e), S;
|
|
286
282
|
}
|
|
287
283
|
f.i = E;
|
|
288
284
|
try {
|
|
@@ -291,38 +287,38 @@
|
|
|
291
287
|
if (l.onGeneralError?.call(n, e) !== !0) throw e;
|
|
292
288
|
return;
|
|
293
289
|
} finally{
|
|
294
|
-
|
|
290
|
+
a(c), b.delete(E);
|
|
295
291
|
}
|
|
296
292
|
return S;
|
|
297
293
|
}
|
|
298
|
-
let
|
|
299
|
-
$call: (e, ...t)=>
|
|
300
|
-
$callOptional: (e, ...t)=>
|
|
301
|
-
$callEvent: (e, ...t)=>
|
|
302
|
-
$callRaw: (e)=>
|
|
294
|
+
let P = {
|
|
295
|
+
$call: (e, ...t)=>S(e, t, !1),
|
|
296
|
+
$callOptional: (e, ...t)=>S(e, t, !1, !0),
|
|
297
|
+
$callEvent: (e, ...t)=>S(e, t, !0),
|
|
298
|
+
$callRaw: (e)=>S(e.method, e.args, e.event, e.optional),
|
|
303
299
|
$rejectPendingCalls: function(e) {
|
|
304
|
-
let t = Array.from(
|
|
300
|
+
let t = Array.from(b.values()).map(({ method: t, reject: a })=>e ? e({
|
|
305
301
|
method: t,
|
|
306
302
|
reject: a
|
|
307
303
|
}) : a(Error(`[birpc]: rejected pending call "${t}".`)));
|
|
308
|
-
return
|
|
304
|
+
return b.clear(), t;
|
|
309
305
|
},
|
|
310
306
|
get $closed () {
|
|
311
|
-
return
|
|
307
|
+
return m;
|
|
312
308
|
},
|
|
313
309
|
get $meta () {
|
|
314
310
|
return l.meta;
|
|
315
311
|
},
|
|
316
312
|
$close: function(e) {
|
|
317
|
-
|
|
313
|
+
m = !0, b.forEach(({ reject: t, method: a })=>{
|
|
318
314
|
let r = Error(`[birpc] rpc is closed, cannot call "${a}"`);
|
|
319
315
|
if (e) return e.cause ??= r, t(e);
|
|
320
316
|
t(r);
|
|
321
|
-
}),
|
|
317
|
+
}), b.clear(), d(v);
|
|
322
318
|
},
|
|
323
319
|
$functions: i
|
|
324
320
|
};
|
|
325
|
-
async function
|
|
321
|
+
async function v(e, ...t) {
|
|
326
322
|
let r;
|
|
327
323
|
try {
|
|
328
324
|
r = w(e);
|
|
@@ -331,50 +327,50 @@
|
|
|
331
327
|
return;
|
|
332
328
|
}
|
|
333
329
|
if ("q" === r.t) {
|
|
334
|
-
let e,
|
|
335
|
-
if (
|
|
336
|
-
e = await
|
|
330
|
+
let e, a, { m: o, a: h, o: d } = r, c = await (p ? p.call(n, o, i[o]) : i[o]);
|
|
331
|
+
if (d && (c ||= ()=>void 0), c) try {
|
|
332
|
+
e = await c.apply("rpc" === f ? n : i, h);
|
|
337
333
|
} catch (e) {
|
|
338
|
-
|
|
334
|
+
a = e;
|
|
339
335
|
}
|
|
340
|
-
else
|
|
336
|
+
else a = Error(`[birpc] function "${o}" not found`);
|
|
341
337
|
if (r.i) {
|
|
342
|
-
if (
|
|
343
|
-
if (!
|
|
338
|
+
if (a && l.onFunctionError && !0 === l.onFunctionError.call(n, a, o, h)) return;
|
|
339
|
+
if (!a) try {
|
|
344
340
|
await s(u({
|
|
345
341
|
t: "s",
|
|
346
342
|
i: r.i,
|
|
347
343
|
r: e
|
|
348
|
-
}), ...
|
|
344
|
+
}), ...t);
|
|
349
345
|
return;
|
|
350
346
|
} catch (e) {
|
|
351
|
-
if (
|
|
347
|
+
if (a = e, l.onGeneralError?.call(n, e, o, h) !== !0) throw e;
|
|
352
348
|
}
|
|
353
349
|
try {
|
|
354
350
|
await s(u({
|
|
355
351
|
t: "s",
|
|
356
352
|
i: r.i,
|
|
357
|
-
e:
|
|
358
|
-
}), ...
|
|
353
|
+
e: a
|
|
354
|
+
}), ...t);
|
|
359
355
|
} catch (e) {
|
|
360
356
|
if (l.onGeneralError?.call(n, e, o, h) !== !0) throw e;
|
|
361
357
|
}
|
|
362
358
|
}
|
|
363
359
|
} else {
|
|
364
|
-
let { i: e, r:
|
|
365
|
-
l && (
|
|
360
|
+
let { i: e, r: t, e: i } = r, l = b.get(e);
|
|
361
|
+
l && (a(l.timeoutId), i ? l.reject(i) : l.resolve(t)), b.delete(e);
|
|
366
362
|
}
|
|
367
363
|
}
|
|
368
|
-
return n = new Proxy({}, {
|
|
364
|
+
return n = y ? new Proxy({}, {
|
|
369
365
|
get (e, t) {
|
|
370
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
371
|
-
if ("then" === t && !
|
|
372
|
-
let a = (...e)=>
|
|
373
|
-
if (
|
|
374
|
-
let r = (...e)=>
|
|
366
|
+
if (Object.prototype.hasOwnProperty.call(P, t)) return P[t];
|
|
367
|
+
if ("then" === t && !c.includes("then") && !("then" in i)) return;
|
|
368
|
+
let a = (...e)=>S(t, e, !0);
|
|
369
|
+
if (c.includes(t)) return a.asEvent = a, a;
|
|
370
|
+
let r = (...e)=>S(t, e, !1);
|
|
375
371
|
return r.asEvent = a, r;
|
|
376
372
|
}
|
|
377
|
-
}), o = h(
|
|
373
|
+
}) : P, o = h(v), n;
|
|
378
374
|
}({
|
|
379
375
|
onTestFileUpdate (e) {
|
|
380
376
|
y("onTestFileUpdate", e.length), b(e);
|
|
@@ -383,7 +379,7 @@
|
|
|
383
379
|
y("reloadTestFile", e, t), m(e, t);
|
|
384
380
|
}
|
|
385
381
|
}, {
|
|
386
|
-
timeout:
|
|
382
|
+
timeout: c,
|
|
387
383
|
post (e) {
|
|
388
384
|
o.readyState === WebSocket.OPEN && o.send(JSON.stringify(e));
|
|
389
385
|
},
|
|
@@ -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.97ee79b0.js"></script><script defer src="/container-static/js/
|
|
15
|
+
<script defer src="/container-static/js/lib-react.97ee79b0.js"></script><script defer src="/container-static/js/565.226c9ef5.js"></script><script defer src="/container-static/js/index.c1d17467.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>
|
|
@@ -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/scheduler.
|
|
15
|
+
<script defer src="/container-static/js/scheduler.5accca0c.js"></script></head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="root"></div>
|
|
18
18
|
</body>
|
package/dist/index.js
CHANGED
|
@@ -1417,15 +1417,32 @@ __webpack_require__.add({
|
|
|
1417
1417
|
});
|
|
1418
1418
|
const TYPE_REQUEST = "q";
|
|
1419
1419
|
const TYPE_RESPONSE = "s";
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1420
|
+
function createPromiseWithResolvers() {
|
|
1421
|
+
let resolve;
|
|
1422
|
+
let reject;
|
|
1423
|
+
return {
|
|
1424
|
+
promise: new Promise((res, rej)=>{
|
|
1425
|
+
resolve = res;
|
|
1426
|
+
reject = rej;
|
|
1427
|
+
}),
|
|
1428
|
+
resolve,
|
|
1429
|
+
reject
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
const random = Math.random.bind(Math);
|
|
1433
|
+
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1434
|
+
function nanoid(size = 21) {
|
|
1435
|
+
let id = "";
|
|
1436
|
+
let i = size;
|
|
1437
|
+
while(i--)id += urlAlphabet[64 * random() | 0];
|
|
1438
|
+
return id;
|
|
1423
1439
|
}
|
|
1440
|
+
const DEFAULT_TIMEOUT = 6e4;
|
|
1441
|
+
const defaultSerialize = (i)=>i;
|
|
1424
1442
|
const defaultDeserialize = defaultSerialize;
|
|
1425
1443
|
const { clearTimeout: dist_clearTimeout, setTimeout: dist_setTimeout } = globalThis;
|
|
1426
|
-
const random = Math.random.bind(Math);
|
|
1427
1444
|
function createBirpc($functions, options) {
|
|
1428
|
-
const { post, on, off = ()=>{}, eventNames = [], serialize = defaultSerialize, deserialize = defaultDeserialize, resolver, bind = "rpc", timeout = DEFAULT_TIMEOUT } = options;
|
|
1445
|
+
const { post, on, off = ()=>{}, eventNames = [], serialize = defaultSerialize, deserialize = defaultDeserialize, resolver, bind = "rpc", timeout = DEFAULT_TIMEOUT, proxify = true } = options;
|
|
1429
1446
|
let $closed = false;
|
|
1430
1447
|
const _rpcPromiseMap = /* @__PURE__ */ new Map();
|
|
1431
1448
|
let _promiseInit;
|
|
@@ -1453,8 +1470,7 @@ function createBirpc($functions, options) {
|
|
|
1453
1470
|
if (timeout >= 0) {
|
|
1454
1471
|
timeoutId = dist_setTimeout(()=>{
|
|
1455
1472
|
try {
|
|
1456
|
-
|
|
1457
|
-
if (true !== handleResult) throw new Error(`[birpc] timeout on calling "${method}"`);
|
|
1473
|
+
if (options.onTimeoutError?.call(rpc, method, args) !== true) throw new Error(`[birpc] timeout on calling "${method}"`);
|
|
1458
1474
|
} catch (e) {
|
|
1459
1475
|
reject(e);
|
|
1460
1476
|
}
|
|
@@ -1483,15 +1499,11 @@ function createBirpc($functions, options) {
|
|
|
1483
1499
|
}
|
|
1484
1500
|
return promise;
|
|
1485
1501
|
}
|
|
1486
|
-
const $call = (method, ...args)=>_call(method, args, false);
|
|
1487
|
-
const $callOptional = (method, ...args)=>_call(method, args, false, true);
|
|
1488
|
-
const $callEvent = (method, ...args)=>_call(method, args, true);
|
|
1489
|
-
const $callRaw = (options2)=>_call(options2.method, options2.args, options2.event, options2.optional);
|
|
1490
1502
|
const builtinMethods = {
|
|
1491
|
-
$call,
|
|
1492
|
-
$callOptional,
|
|
1493
|
-
$callEvent,
|
|
1494
|
-
$callRaw,
|
|
1503
|
+
$call: (method, ...args)=>_call(method, args, false),
|
|
1504
|
+
$callOptional: (method, ...args)=>_call(method, args, false, true),
|
|
1505
|
+
$callEvent: (method, ...args)=>_call(method, args, true),
|
|
1506
|
+
$callRaw: (options$1)=>_call(options$1.method, options$1.args, options$1.event, options$1.optional),
|
|
1495
1507
|
$rejectPendingCalls,
|
|
1496
1508
|
get $closed () {
|
|
1497
1509
|
return $closed;
|
|
@@ -1502,7 +1514,7 @@ function createBirpc($functions, options) {
|
|
|
1502
1514
|
$close,
|
|
1503
1515
|
$functions
|
|
1504
1516
|
};
|
|
1505
|
-
rpc = new Proxy({}, {
|
|
1517
|
+
rpc = proxify ? new Proxy({}, {
|
|
1506
1518
|
get (_, method) {
|
|
1507
1519
|
if (Object.prototype.hasOwnProperty.call(builtinMethods, method)) return builtinMethods[method];
|
|
1508
1520
|
if ("then" === method && !eventNames.includes("then") && !("then" in $functions)) return;
|
|
@@ -1515,11 +1527,11 @@ function createBirpc($functions, options) {
|
|
|
1515
1527
|
sendCall.asEvent = sendEvent;
|
|
1516
1528
|
return sendCall;
|
|
1517
1529
|
}
|
|
1518
|
-
});
|
|
1530
|
+
}) : builtinMethods;
|
|
1519
1531
|
function $close(customError) {
|
|
1520
1532
|
$closed = true;
|
|
1521
1533
|
_rpcPromiseMap.forEach(({ reject, method })=>{
|
|
1522
|
-
const error = new Error(`[birpc] rpc is closed, cannot call "${method}"`);
|
|
1534
|
+
const error = /* @__PURE__ */ new Error(`[birpc] rpc is closed, cannot call "${method}"`);
|
|
1523
1535
|
if (customError) {
|
|
1524
1536
|
customError.cause ??= error;
|
|
1525
1537
|
return reject(customError);
|
|
@@ -1530,9 +1542,8 @@ function createBirpc($functions, options) {
|
|
|
1530
1542
|
off(onMessage);
|
|
1531
1543
|
}
|
|
1532
1544
|
function $rejectPendingCalls(handler) {
|
|
1533
|
-
const
|
|
1534
|
-
|
|
1535
|
-
if (!handler) return reject(new Error(`[birpc]: rejected pending call "${method}".`));
|
|
1545
|
+
const handlerResults = Array.from(_rpcPromiseMap.values()).map(({ method, reject })=>{
|
|
1546
|
+
if (!handler) return reject(/* @__PURE__ */ new Error(`[birpc]: rejected pending call "${method}".`));
|
|
1536
1547
|
return handler({
|
|
1537
1548
|
method,
|
|
1538
1549
|
reject
|
|
@@ -1559,9 +1570,8 @@ function createBirpc($functions, options) {
|
|
|
1559
1570
|
} catch (e) {
|
|
1560
1571
|
error = e;
|
|
1561
1572
|
}
|
|
1562
|
-
else error = new Error(`[birpc] function "${method}" not found`);
|
|
1573
|
+
else error = /* @__PURE__ */ new Error(`[birpc] function "${method}" not found`);
|
|
1563
1574
|
if (msg.i) {
|
|
1564
|
-
if (error && options.onError) options.onError.call(rpc, error, method, args);
|
|
1565
1575
|
if (error && options.onFunctionError) {
|
|
1566
1576
|
if (true === options.onFunctionError.call(rpc, error, method, args)) return;
|
|
1567
1577
|
}
|
|
@@ -1600,26 +1610,6 @@ function createBirpc($functions, options) {
|
|
|
1600
1610
|
_promiseInit = on(onMessage);
|
|
1601
1611
|
return rpc;
|
|
1602
1612
|
}
|
|
1603
|
-
function createPromiseWithResolvers() {
|
|
1604
|
-
let resolve;
|
|
1605
|
-
let reject;
|
|
1606
|
-
const promise = new Promise((res, rej)=>{
|
|
1607
|
-
resolve = res;
|
|
1608
|
-
reject = rej;
|
|
1609
|
-
});
|
|
1610
|
-
return {
|
|
1611
|
-
promise,
|
|
1612
|
-
resolve,
|
|
1613
|
-
reject
|
|
1614
|
-
};
|
|
1615
|
-
}
|
|
1616
|
-
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1617
|
-
function nanoid(size = 21) {
|
|
1618
|
-
let id = "";
|
|
1619
|
-
let i = size;
|
|
1620
|
-
while(i--)id += urlAlphabet[64 * random() | 0];
|
|
1621
|
-
return id;
|
|
1622
|
-
}
|
|
1623
1613
|
const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js");
|
|
1624
1614
|
const { createRsbuild: createRsbuild, rspack: rspack } = rsbuild;
|
|
1625
1615
|
const hostController_dirname = dirname(fileURLToPath(import.meta.url));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstest/browser",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "Browser mode support for Rstest testing framework.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
"@types/picomatch": "^4.0.2",
|
|
49
49
|
"@types/ws": "^8.18.1",
|
|
50
50
|
"@vitest/snapshot": "^3.2.4",
|
|
51
|
-
"birpc": "
|
|
51
|
+
"birpc": "^4.0.0",
|
|
52
52
|
"picocolors": "^1.1.1",
|
|
53
53
|
"picomatch": "^4.0.3",
|
|
54
54
|
"playwright": "^1.49.1",
|
|
55
55
|
"@rstest/browser-ui": "0.0.0",
|
|
56
56
|
"@rstest/tsconfig": "0.0.1",
|
|
57
|
-
"@rstest/core": "0.8.
|
|
57
|
+
"@rstest/core": "0.8.5"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"playwright": "^1.49.1",
|
|
61
|
-
"@rstest/core": "^0.8.
|
|
61
|
+
"@rstest/core": "^0.8.5"
|
|
62
62
|
},
|
|
63
63
|
"peerDependenciesMeta": {
|
|
64
64
|
"playwright": {
|
package/src/client/entry.ts
CHANGED
|
@@ -426,12 +426,13 @@ const run = async () => {
|
|
|
426
426
|
return;
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
429
|
+
const loadSetupFiles = async (): Promise<void> => {
|
|
430
|
+
for (const loadSetup of currentSetupLoaders) {
|
|
431
|
+
await loadSetup();
|
|
432
|
+
}
|
|
433
|
+
};
|
|
433
434
|
|
|
434
|
-
//
|
|
435
|
+
// 1. Determine which test files to run
|
|
435
436
|
let testKeysToRun: string[];
|
|
436
437
|
|
|
437
438
|
if (targetTestFile) {
|
|
@@ -478,6 +479,9 @@ const run = async () => {
|
|
|
478
479
|
}
|
|
479
480
|
|
|
480
481
|
try {
|
|
482
|
+
// Load setup files for this project after runtime is ready.
|
|
483
|
+
await loadSetupFiles();
|
|
484
|
+
|
|
481
485
|
// Load the test file dynamically (registers tests without running)
|
|
482
486
|
await currentTestContext.loadTest(key);
|
|
483
487
|
|
|
@@ -512,7 +516,7 @@ const run = async () => {
|
|
|
512
516
|
return;
|
|
513
517
|
}
|
|
514
518
|
|
|
515
|
-
//
|
|
519
|
+
// 2. Run tests for each file
|
|
516
520
|
for (const key of testKeysToRun) {
|
|
517
521
|
const testPath = toAbsolutePath(key, currentProject.projectRoot);
|
|
518
522
|
|
|
@@ -573,6 +577,9 @@ const run = async () => {
|
|
|
573
577
|
});
|
|
574
578
|
|
|
575
579
|
try {
|
|
580
|
+
// Load setup files for this project after runtime is ready.
|
|
581
|
+
await loadSetupFiles();
|
|
582
|
+
|
|
576
583
|
// Record script URLs before loading the test file
|
|
577
584
|
const beforeScripts = getScriptUrls();
|
|
578
585
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 392.28f9a733.js.LICENSE.txt */
|