@rstest/browser 0.9.5 → 0.9.7

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 @@
1
+ /*! LICENSE: 407.89ee95c89d.js.LICENSE.txt */
@@ -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(1215), i = s(7267), n = s(7723), c = s(162), d = s(2739);
7
+ var a = s(7283), i = s(281), n = s(7026), 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(367), h = s(4681), f = s(4335), x = s(6942), m = s(396);
18
+ var p = s(8609), h = s(6490), 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(3897), F = s(3146), N = s(9596), A = s(1309), P = s(5758), M = s(9031), z = s(3168), O = s(2024);
81
+ var S = s(5446), F = s(8426), N = s(2585), 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(112);
517
+ var G = s(324);
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(3663), Y = s(4923), Q = s(8346), ee = s(407), et = s(3571), es = s(288);
1588
+ var K = s(7239), Y = s(4923), Q = s(8346), ee = s(407), et = s(3571), es = s(7889);
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(1505), ea = s(8198), ei = s(2559), en = s(7957), ec = s(719);
1728
+ var eo = s(5860), ea = s(6254), 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
- "677"
3072
+ "407"
3073
3073
  ], ()=>n(5645));
3074
3074
  c = n.O(c);
3075
3075
  })();
@@ -1,5 +1,5 @@
1
- /*! LICENSE: lib-react.f905279759.js.LICENSE.txt */
2
- /*! LICENSE: lib-react.f905279759.js.LICENSE.txt */ "use strict";
1
+ /*! LICENSE: lib-react.57a7325be2.js.LICENSE.txt */
2
+ /*! LICENSE: lib-react.57a7325be2.js.LICENSE.txt */ "use strict";
3
3
  (self.rspackChunk_rstest_browser_ui = self.rspackChunk_rstest_browser_ui || []).push([
4
4
  [
5
5
  "783"
@@ -2327,7 +2327,7 @@
2327
2327
  $(lW, lW.current), $(lU, e), null === l$ && (l$ = e);
2328
2328
  }
2329
2329
  function lV(e) {
2330
- 22 === e.tag ? ($(lW, lW.current), $(lU, e), null === l$ && (l$ = e)) : lB(e);
2330
+ 22 === e.tag ? ($(lW, lW.current), $(lU, e), null === l$ && (l$ = e)) : lB();
2331
2331
  }
2332
2332
  function lB() {
2333
2333
  $(lW, lW.current), $(lU, lU.current);
@@ -2903,8 +2903,8 @@
2903
2903
  }, function(e) {
2904
2904
  for(f.status = "rejected", f.reason = e, e = 0; e < c.length; e++)(0, c[e])(void 0);
2905
2905
  }), f);
2906
- a5(e, t, d, uo(e));
2907
- } else a5(e, t, r, uo(e));
2906
+ a5(e, t, d, uo());
2907
+ } else a5(e, t, r, uo());
2908
2908
  } catch (n) {
2909
2909
  a5(e, t, {
2910
2910
  then: function() {},
@@ -3443,7 +3443,7 @@
3443
3443
  baseLanes: 0,
3444
3444
  cachePool: null
3445
3445
  }, null !== e && ln(t, null !== a ? a.cachePool : null), null !== a ? lA(t, a) : lM(), lV(t);
3446
- } else null !== a ? (ln(t, a.cachePool), lA(t, a), lB(t), t.memoizedState = null) : (null !== e && ln(t, null), lM(), lB(t));
3446
+ } else null !== a ? (ln(t, a.cachePool), lA(t, a), lB(), t.memoizedState = null) : (null !== e && ln(t, null), lM(), lB());
3447
3447
  return ow(e, t, l, n), t.child;
3448
3448
  }
3449
3449
  function o_(e, t) {
@@ -3530,7 +3530,7 @@
3530
3530
  var r, l = t.pendingProps, a = !1, o = 0 != (128 & t.flags);
3531
3531
  if ((r = o) || (r = (null === e || null !== e.memoizedState) && 0 != (2 & lW.current)), r && (a = !0, t.flags &= -129), r = 0 != (32 & t.flags), t.flags &= -33, null === e) {
3532
3532
  if (rP) {
3533
- if (a ? lj(t) : lB(t), (e = rz) ? null !== (e = null !== (e = sL(e, rT)) && "&" !== e.data ? e : null) && (t.memoizedState = {
3533
+ if (a ? lj(t) : lB(), (e = rz) ? null !== (e = null !== (e = sL(e, rT)) && "&" !== e.data ? e : null) && (t.memoizedState = {
3534
3534
  dehydrated: e,
3535
3535
  treeContext: null !== rv ? {
3536
3536
  id: rb,
@@ -3542,14 +3542,14 @@
3542
3542
  return sD(e) ? t.lanes = 32 : t.lanes = 0x20000000, null;
3543
3543
  }
3544
3544
  var u = l.children;
3545
- return (l = l.fallback, a) ? (lB(t), u = o$({
3545
+ return (l = l.fallback, a) ? (lB(), u = o$({
3546
3546
  mode: "hidden",
3547
3547
  children: u
3548
3548
  }, a = t.mode), l = ro(l, a, n, null), u.return = t, l.return = t, u.sibling = l, t.child = u, (l = t.child).memoizedState = oA(n), l.childLanes = oM(e, r, n), t.memoizedState = oR, o_(null, l)) : (lj(t), oU(t, u));
3549
3549
  }
3550
3550
  var s = e.memoizedState;
3551
3551
  if (null !== s && null !== (u = s.dehydrated)) {
3552
- if (o) 256 & t.flags ? (lj(t), t.flags &= -257, t = oj(e, t, n)) : null !== t.memoizedState ? (lB(t), t.child = e.child, t.flags |= 128, t = null) : (lB(t), u = l.fallback, a = t.mode, l = o$({
3552
+ if (o) 256 & t.flags ? (lj(t), t.flags &= -257, t = oj(e, t, n)) : null !== t.memoizedState ? (lB(), t.child = e.child, t.flags |= 128, t = null) : (lB(), u = l.fallback, a = t.mode, l = o$({
3553
3553
  mode: "visible",
3554
3554
  children: l.children
3555
3555
  }, a), u = ro(u, a, n, null), u.flags |= 2, l.return = t, u.return = t, l.sibling = u, t.child = l, lk(t, e.child, null, n), (l = t.child).memoizedState = oA(n), l.childLanes = oM(e, r, n), t.memoizedState = oR, t = o_(null, l));
@@ -3566,7 +3566,7 @@
3566
3566
  } else sO(u) ? (t.flags |= 192, t.child = e.child, t = null) : (e = s.treeContext, rz = sF(u.nextSibling), r_ = t, rP = !0, rN = null, rT = !1, null !== e && rC(t, e), t = oU(t, l.children), t.flags |= 4096);
3567
3567
  return t;
3568
3568
  }
3569
- return a ? (lB(t), u = l.fallback, a = t.mode, c = (s = e.child).sibling, (l = rr(s, {
3569
+ return a ? (lB(), u = l.fallback, a = t.mode, c = (s = e.child).sibling, (l = rr(s, {
3570
3570
  mode: "hidden",
3571
3571
  children: l.children
3572
3572
  })).subtreeFlags = 0x3e00000 & s.subtreeFlags, null !== c ? u = rr(c, u) : (u = ro(u, a, n, null), u.flags |= 2), u.return = t, l.return = t, l.sibling = u, t.child = l, o_(null, l), l = t.child, null === (u = e.child.memoizedState) ? u = oA(n) : (null !== (a = u.cachePool) ? (s = r1._currentValue, a = a.parent !== s ? {
@@ -5413,7 +5413,7 @@
5413
5413
  if (null === t.stateNode) throw Error(i(166));
5414
5414
  return oJ(t), null;
5415
5415
  }
5416
- e = j.current, rR(t) ? rD(t, e) : (t.stateNode = e = sI(l, r, n), oK(t));
5416
+ e = j.current, rR(t) ? rD(t) : (t.stateNode = e = sI(l, r, n), oK(t));
5417
5417
  }
5418
5418
  return oJ(t), null;
5419
5419
  case 5:
@@ -5423,7 +5423,7 @@
5423
5423
  if (null === t.stateNode) throw Error(i(166));
5424
5424
  return oJ(t), null;
5425
5425
  }
5426
- if (a = j.current, rR(t)) rD(t, a);
5426
+ if (a = j.current, rR(t)) rD(t);
5427
5427
  else {
5428
5428
  var o = sy(V.current);
5429
5429
  switch(a){
@@ -0,0 +1 @@
1
+ /*! LICENSE: lib-react.57a7325be2.js.LICENSE.txt */
@@ -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/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>
15
+ <script defer src="/container-static/js/lib-react.57a7325be2.js"></script><script defer src="/container-static/js/407.89ee95c89d.js"></script><script defer src="/container-static/js/index.3ad6624086.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>
@@ -7,6 +7,17 @@ type BrowserLazyCompilationConfig = {
7
7
  entries: false;
8
8
  test?: (module: LazyCompilationModule) => boolean;
9
9
  };
10
+ /**
11
+ * Resolve the actual port the dev server is listening on.
12
+ *
13
+ * Rsbuild's `devServer.listen()` may return `0` when configured with
14
+ * `server.port: 0` because its internal `getPort` never reads back the
15
+ * OS-assigned ephemeral port. This helper falls back to
16
+ * `httpServer.address()` to obtain the real bound port.
17
+ */
18
+ export declare const resolveListenPort: (listenPort: number, httpServer: {
19
+ address: () => ReturnType<import("node:net").Server["address"]>;
20
+ } | null) => number;
10
21
  export declare const createBrowserLazyCompilationConfig: (setupFiles: string[]) => BrowserLazyCompilationConfig;
11
22
  export declare const createBrowserRsbuildDevConfig: (_isWatchMode: boolean) => {
12
23
  writeToDisk: boolean;
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { __webpack_require__ } from "./rslib-runtime.js";
2
1
  import { existsSync } from "node:fs";
3
2
  import promises from "node:fs/promises";
4
3
  import { fileURLToPath } from "node:url";
@@ -10,6 +9,7 @@ import sirv from "sirv";
10
9
  import { WebSocketServer } from "ws";
11
10
  import node_os from "node:os";
12
11
  import convert_source_map from "convert-source-map";
12
+ import { __webpack_require__ } from "./rslib-runtime.js";
13
13
  import { DISPATCH_RPC_BRIDGE_NAME, DISPATCH_MESSAGE_TYPE, DISPATCH_NAMESPACE_RUNNER } from "./323.js";
14
14
  __webpack_require__.add({
15
15
  "../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
@@ -2951,6 +2951,12 @@ const applyDefaultWatchOptions = (rspackConfig, isWatchMode)=>{
2951
2951
  if (0 === rspackConfig.watchOptions.ignored.length) rspackConfig.watchOptions.ignored.push('**/.git', '**/node_modules');
2952
2952
  rspackConfig.output?.path && rspackConfig.watchOptions.ignored.push(rspackConfig.output.path);
2953
2953
  };
2954
+ const resolveListenPort = (listenPort, httpServer)=>{
2955
+ if (listenPort) return listenPort;
2956
+ const addr = httpServer?.address();
2957
+ if (addr && 'object' == typeof addr) return addr.port;
2958
+ return listenPort;
2959
+ };
2954
2960
  const createBrowserLazyCompilationConfig = (setupFiles)=>{
2955
2961
  const eagerSetupFiles = new Set(setupFiles.map((filePath)=>normalize(filePath)));
2956
2962
  if (0 === eagerSetupFiles.size) return {
@@ -3507,7 +3513,8 @@ const createBrowserRuntime = async ({ context, manifestPath, manifestSource, tem
3507
3513
  }
3508
3514
  next();
3509
3515
  });
3510
- const { port } = await devServer.listen();
3516
+ const { port: listenPort } = await devServer.listen();
3517
+ const port = resolveListenPort(listenPort, devServer.httpServer);
3511
3518
  const wss = new WebSocketServer({
3512
3519
  port: 0
3513
3520
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstest/browser",
3
- "version": "0.9.5",
3
+ "version": "0.9.7",
4
4
  "description": "Browser mode support for Rstest testing framework.",
5
5
  "keywords": [
6
6
  "rstest",
@@ -48,22 +48,22 @@
48
48
  "ws": "^8.20.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@rslib/core": "0.20.0",
51
+ "@rslib/core": "0.21.0",
52
52
  "@types/convert-source-map": "^2.0.3",
53
- "@types/picomatch": "^4.0.2",
53
+ "@types/picomatch": "^4.0.3",
54
54
  "@types/ws": "^8.18.1",
55
- "@typescript/native-preview": "7.0.0-dev.20260317.1",
55
+ "@typescript/native-preview": "7.0.0-dev.20260408.1",
56
56
  "@vitest/snapshot": "^3.2.4",
57
57
  "birpc": "^4.0.0",
58
58
  "picomatch": "^4.0.4",
59
- "playwright": "^1.58.2",
60
- "@rstest/core": "0.9.5",
59
+ "playwright": "^1.59.1",
61
60
  "@rstest/browser-ui": "0.0.0",
61
+ "@rstest/core": "0.9.7",
62
62
  "@rstest/tsconfig": "0.0.1"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "playwright": "^1.49.1",
66
- "@rstest/core": "^0.9.5"
66
+ "@rstest/core": "^0.9.7"
67
67
  },
68
68
  "peerDependenciesMeta": {
69
69
  "playwright": {
@@ -80,6 +80,6 @@
80
80
  "scripts": {
81
81
  "build": "rslib build",
82
82
  "dev": "rslib build --watch",
83
- "typecheck": "tsc --noEmit"
83
+ "typecheck": "pnpm -w exec tsc --noEmit -p packages/browser/tsconfig.json"
84
84
  }
85
85
  }
@@ -518,6 +518,30 @@ type BrowserLazyCompilationConfig = {
518
518
  test?: (module: LazyCompilationModule) => boolean;
519
519
  };
520
520
 
521
+ /**
522
+ * Resolve the actual port the dev server is listening on.
523
+ *
524
+ * Rsbuild's `devServer.listen()` may return `0` when configured with
525
+ * `server.port: 0` because its internal `getPort` never reads back the
526
+ * OS-assigned ephemeral port. This helper falls back to
527
+ * `httpServer.address()` to obtain the real bound port.
528
+ */
529
+ export const resolveListenPort = (
530
+ listenPort: number,
531
+ httpServer: {
532
+ address: () => ReturnType<import('node:net').Server['address']>;
533
+ } | null,
534
+ ): number => {
535
+ if (listenPort) {
536
+ return listenPort;
537
+ }
538
+ const addr = httpServer?.address();
539
+ if (addr && typeof addr === 'object') {
540
+ return addr.port;
541
+ }
542
+ return listenPort;
543
+ };
544
+
521
545
  export const createBrowserLazyCompilationConfig = (
522
546
  setupFiles: string[],
523
547
  ): BrowserLazyCompilationConfig => {
@@ -1549,7 +1573,8 @@ const createBrowserRuntime = async ({
1549
1573
  },
1550
1574
  );
1551
1575
 
1552
- const { port } = await devServer.listen();
1576
+ const { port: listenPort } = await devServer.listen();
1577
+ const port = resolveListenPort(listenPort, devServer.httpServer);
1553
1578
 
1554
1579
  // Create WebSocket server on an available port
1555
1580
  // Using port: 0 lets the OS assign an available port, avoiding conflicts
@@ -1 +0,0 @@
1
- /*! LICENSE: 677.d1243053e0.js.LICENSE.txt */
@@ -1 +0,0 @@
1
- /*! LICENSE: lib-react.f905279759.js.LICENSE.txt */