@rstest/browser 0.9.5 → 0.9.6

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
  })();
@@ -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.f905279759.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.6",
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.20.2",
52
52
  "@types/convert-source-map": "^2.0.3",
53
53
  "@types/picomatch": "^4.0.2",
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.20260331.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.0",
61
60
  "@rstest/browser-ui": "0.0.0",
62
- "@rstest/tsconfig": "0.0.1"
61
+ "@rstest/tsconfig": "0.0.1",
62
+ "@rstest/core": "0.9.6"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "playwright": "^1.49.1",
66
- "@rstest/core": "^0.9.5"
66
+ "@rstest/core": "^0.9.6"
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 */