@rstest/browser 0.10.2 → 0.10.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.
Files changed (43) hide show
  1. package/dist/{323.js → 626.js} +2 -3
  2. package/dist/browser-container/container-static/js/{188.480c3c49b5.js → 3.d3d6c6e4cf.js} +2908 -2915
  3. package/dist/browser-container/container-static/js/3.d3d6c6e4cf.js.LICENSE.txt +1 -0
  4. package/dist/browser-container/container-static/js/{index.29fc60be33.js → index.8fb1588e4a.js} +431 -455
  5. package/dist/browser-container/container-static/js/{lib-react.5ae9b90ee5.js → lib-react.62b27a21db.js} +21 -21
  6. package/dist/browser-container/container-static/js/lib-react.62b27a21db.js.LICENSE.txt +1 -0
  7. package/dist/browser-container/index.html +1 -1
  8. package/dist/browser.js +5 -5
  9. package/dist/client/dispatchTransport.d.ts +19 -0
  10. package/dist/client/public.d.ts +3 -3
  11. package/dist/client/sourceMapSupport.d.ts +1 -1
  12. package/dist/concurrency.d.ts +3 -3
  13. package/dist/configValidation.d.ts +2 -2
  14. package/dist/dispatchCapabilities.d.ts +1 -1
  15. package/dist/hostController.d.ts +3 -3
  16. package/dist/index.d.ts +5 -5
  17. package/dist/index.js +209 -221
  18. package/dist/protocol.d.ts +45 -18
  19. package/dist/providers/index.d.ts +11 -1
  20. package/dist/rpcProtocol.d.ts +32 -18
  21. package/dist/rslib-runtime.js +9 -5
  22. package/dist/viewportPresets.d.ts +5 -0
  23. package/package.json +8 -8
  24. package/src/AGENTS.md +7 -1
  25. package/src/client/dispatchTransport.ts +63 -1
  26. package/src/client/entry.ts +25 -58
  27. package/src/client/public.ts +3 -3
  28. package/src/client/snapshot.ts +24 -22
  29. package/src/client/sourceMapSupport.ts +1 -1
  30. package/src/concurrency.ts +6 -20
  31. package/src/configValidation.ts +2 -2
  32. package/src/dispatchCapabilities.ts +102 -83
  33. package/src/env.d.ts +6 -2
  34. package/src/hostController.ts +76 -42
  35. package/src/index.ts +22 -11
  36. package/src/protocol.ts +66 -22
  37. package/src/providers/index.ts +11 -1
  38. package/src/providers/playwright/runtime.ts +104 -4
  39. package/src/rpcProtocol.ts +34 -21
  40. package/src/viewportPresets.ts +5 -0
  41. package/src/watchCliShortcuts.ts +2 -4
  42. package/dist/browser-container/container-static/js/188.480c3c49b5.js.LICENSE.txt +0 -1
  43. package/dist/browser-container/container-static/js/lib-react.5ae9b90ee5.js.LICENSE.txt +0 -1
@@ -1,12 +1,12 @@
1
- /*! LICENSE: lib-react.5ae9b90ee5.js.LICENSE.txt */
2
- /*! LICENSE: lib-react.5ae9b90ee5.js.LICENSE.txt */ "use strict";
1
+ /*! LICENSE: lib-react.62b27a21db.js.LICENSE.txt */
2
+ /*! LICENSE: lib-react.62b27a21db.js.LICENSE.txt */ "use strict";
3
3
  (self.rspackChunk_rstest_browser_ui = self.rspackChunk_rstest_browser_ui || []).push([
4
4
  [
5
5
  783
6
6
  ],
7
7
  {
8
- 1044 (e, t, n) {
9
- var r, l = n(1099), a = n(7348), o = n(5542);
8
+ 4482 (e, t, n) {
9
+ var r, l = n(1099), a = n(405), o = n(7868);
10
10
  function i(e) {
11
11
  var t = "https://react.dev/errors/" + e;
12
12
  if (1 < arguments.length) {
@@ -7719,7 +7719,7 @@
7719
7719
  }
7720
7720
  };
7721
7721
  var cA = a.version;
7722
- if ("19.2.6" !== cA) throw Error(i(527, cA, "19.2.6"));
7722
+ if ("19.2.7" !== cA) throw Error(i(527, cA, "19.2.7"));
7723
7723
  if (D.findDOMNode = function(e) {
7724
7724
  var t = e._reactInternals;
7725
7725
  if (void 0 === t) {
@@ -7797,10 +7797,10 @@
7797
7797
  if (!cM.isDisabled && cM.supportsFiber) try {
7798
7798
  ed = cM.inject({
7799
7799
  bundleType: 0,
7800
- version: "19.2.6",
7800
+ version: "19.2.7",
7801
7801
  rendererPackageName: "react-dom",
7802
7802
  currentDispatcherRef: O,
7803
- reconcilerVersion: "19.2.6"
7803
+ reconcilerVersion: "19.2.7"
7804
7804
  }), ep = cM;
7805
7805
  } catch (e) {}
7806
7806
  }
@@ -7814,8 +7814,8 @@
7814
7814
  }, lS(o), t = r, e[eM] = t.current, u7(e), new cF(t);
7815
7815
  };
7816
7816
  },
7817
- 1816 (e, t, n) {
7818
- var r = n(7348);
7817
+ 2826 (e, t, n) {
7818
+ var r = n(405);
7819
7819
  function l(e) {
7820
7820
  var t = "https://react.dev/errors/" + e;
7821
7821
  if (1 < arguments.length) {
@@ -7926,27 +7926,27 @@
7926
7926
  return u.H.useFormState(e, t, n);
7927
7927
  }, t.useFormStatus = function() {
7928
7928
  return u.H.useHostTransitionStatus();
7929
- }, t.version = "19.2.6";
7929
+ }, t.version = "19.2.7";
7930
7930
  },
7931
- 2303 (e, t, n) {
7931
+ 7541 (e, t, n) {
7932
7932
  (function e() {
7933
7933
  if ("u" > typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" == typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE) try {
7934
7934
  __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e);
7935
7935
  } catch (e) {
7936
7936
  console.error(e);
7937
7937
  }
7938
- })(), e.exports = n(1044);
7938
+ })(), e.exports = n(4482);
7939
7939
  },
7940
- 5542 (e, t, n) {
7940
+ 7868 (e, t, n) {
7941
7941
  (function e() {
7942
7942
  if ("u" > typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" == typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE) try {
7943
7943
  __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e);
7944
7944
  } catch (e) {
7945
7945
  console.error(e);
7946
7946
  }
7947
- })(), e.exports = n(1816);
7947
+ })(), e.exports = n(2826);
7948
7948
  },
7949
- 810 (e, t) {
7949
+ 8881 (e, t) {
7950
7950
  var n = Symbol.for("react.transitional.element");
7951
7951
  function r(e, t, r) {
7952
7952
  var l = null;
@@ -7962,7 +7962,7 @@
7962
7962
  }
7963
7963
  t.Fragment = Symbol.for("react.fragment"), t.jsx = r, t.jsxs = r;
7964
7964
  },
7965
- 6773 (e, t) {
7965
+ 7866 (e, t) {
7966
7966
  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 = {
7967
7967
  isMounted: function() {
7968
7968
  return !1;
@@ -8240,13 +8240,13 @@
8240
8240
  return E.H.useSyncExternalStore(e, t, n);
8241
8241
  }, t.useTransition = function() {
8242
8242
  return E.H.useTransition();
8243
- }, t.version = "19.2.6";
8243
+ }, t.version = "19.2.7";
8244
8244
  },
8245
- 7348 (e, t, n) {
8246
- e.exports = n(6773);
8245
+ 405 (e, t, n) {
8246
+ e.exports = n(7866);
8247
8247
  },
8248
- 7080 (e, t, n) {
8249
- e.exports = n(810);
8248
+ 9793 (e, t, n) {
8249
+ e.exports = n(8881);
8250
8250
  },
8251
8251
  7146 (e, t) {
8252
8252
  function n(e, t) {
@@ -0,0 +1 @@
1
+ /*! LICENSE: lib-react.62b27a21db.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.5ae9b90ee5.js"></script><script defer src="/container-static/js/188.480c3c49b5.js"></script><script defer src="/container-static/js/index.29fc60be33.js"></script><link href="/container-static/css/index.5c72297783.css" rel="stylesheet"></head>
15
+ <script defer src="/container-static/js/lib-react.62b27a21db.js"></script><script defer src="/container-static/js/3.d3d6c6e4cf.js"></script><script defer src="/container-static/js/index.8fb1588e4a.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>
package/dist/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DISPATCH_RESPONSE_TYPE, DISPATCH_METHOD_RPC, DISPATCH_RPC_REQUEST_TYPE, DISPATCH_MESSAGE_TYPE, DISPATCH_NAMESPACE_BROWSER } from "./323.js";
1
+ import { DISPATCH_RESPONSE_TYPE, DISPATCH_RPC_BRIDGE_NAME as protocol_DISPATCH_RPC_BRIDGE_NAME, DISPATCH_RPC_REQUEST_TYPE as protocol_DISPATCH_RPC_REQUEST_TYPE, DISPATCH_MESSAGE_TYPE as protocol_DISPATCH_MESSAGE_TYPE, DISPATCH_NAMESPACE_BROWSER } from "./626.js";
2
2
  const DEFAULT_RPC_TIMEOUT_MS = 30000;
3
3
  const getRpcTimeout = ()=>window.__RSTEST_BROWSER_OPTIONS__?.rpcTimeout ?? DEFAULT_RPC_TIMEOUT_MS;
4
4
  const pendingRequests = new Map();
@@ -34,7 +34,7 @@ const unwrapDispatchBridgeResult = (requestId, result, staleMessage)=>{
34
34
  };
35
35
  const dispatchRpc = ({ requestId, request, timeoutMs, timeoutMessage, staleMessage })=>{
36
36
  if (window.parent === window) {
37
- const dispatchBridge = window.__rstest_dispatch_rpc__;
37
+ const dispatchBridge = window[protocol_DISPATCH_RPC_BRIDGE_NAME];
38
38
  if (!dispatchBridge) throw new Error('Dispatch RPC bridge is not available in top-level runner.');
39
39
  return new Promise((resolve, reject)=>{
40
40
  const timeoutId = setTimeout(()=>{
@@ -68,9 +68,9 @@ const dispatchRpc = ({ requestId, request, timeoutMs, timeoutMessage, staleMessa
68
68
  }
69
69
  });
70
70
  window.parent.postMessage({
71
- type: DISPATCH_MESSAGE_TYPE,
71
+ type: protocol_DISPATCH_MESSAGE_TYPE,
72
72
  payload: {
73
- type: DISPATCH_RPC_REQUEST_TYPE,
73
+ type: protocol_DISPATCH_RPC_REQUEST_TYPE,
74
74
  payload: request
75
75
  }
76
76
  }, '*');
@@ -97,7 +97,7 @@ const getCurrentRunId = ()=>{
97
97
  const createBrowserDispatchRequest = (requestId, request)=>({
98
98
  requestId,
99
99
  namespace: DISPATCH_NAMESPACE_BROWSER,
100
- method: DISPATCH_METHOD_RPC,
100
+ method: "rpc",
101
101
  args: request,
102
102
  target: {
103
103
  testFile: request.testPath
@@ -1,6 +1,25 @@
1
1
  import type { BrowserDispatchRequest } from '../protocol.js';
2
2
  export declare const getRpcTimeout: () => number;
3
3
  export declare const createRequestId: (prefix: string) => string;
4
+ /**
5
+ * Build a runner-lifecycle dispatch request.
6
+ *
7
+ * Lifecycle events (`file-ready`, `suite-start`, `suite-result`, `case-start`)
8
+ * share the dispatch-rpc envelope but are delivered fire-and-forget via
9
+ * {@link sendRunnerLifecycle}, so the request id only needs to be unique — it is
10
+ * produced by the shared {@link createRequestId} factory rather than a bespoke
11
+ * per-runner counter.
12
+ */
13
+ export declare const createRunnerLifecycleRequest: (method: string, args: unknown) => BrowserDispatchRequest;
14
+ /**
15
+ * Deliver a runner-lifecycle request fire-and-forget.
16
+ *
17
+ * Unlike {@link dispatchRpc}, this never awaits, unwraps, id-matches, or times
18
+ * out: the host echoes a response but the runner ignores it. Failures surface
19
+ * only through the optional `onError` hook (debug logging at the call site),
20
+ * keeping the hot test loop non-blocking.
21
+ */
22
+ export declare const sendRunnerLifecycle: (request: BrowserDispatchRequest, onError?: (error: unknown) => void) => void;
4
23
  export declare const dispatchRpc: <T>({ requestId, request, timeoutMs, timeoutMessage, staleMessage, }: {
5
24
  requestId: string;
6
25
  request: BrowserDispatchRequest;
@@ -1,9 +1,9 @@
1
1
  /**
2
- * Re-export runtime API from @rstest/core/browser-runtime for browser use.
2
+ * Re-export runtime API from @rstest/core/internal/browser-runtime for browser use.
3
3
  * This file is used as an alias target for '@rstest/core' in browser mode.
4
4
  *
5
- * Uses @rstest/core/browser-runtime which only exports the test APIs
5
+ * Uses @rstest/core/internal/browser-runtime which only exports the test APIs
6
6
  * (describe, it, expect, etc.) without any Node.js dependencies.
7
7
  */
8
8
  export type { Assertion, Mock } from '@rstest/core';
9
- export * from '@rstest/core/browser-runtime';
9
+ export * from '@rstest/core/internal/browser-runtime';
@@ -20,7 +20,7 @@ export declare const preloadTestFileSourceMap: (chunkUrl: string) => Promise<voi
20
20
  * Preload source map for the runner.js file.
21
21
  *
22
22
  * This is essential for inline snapshot support because the snapshot code
23
- * runs in runner.js (which contains @rstest/core/browser-runtime).
23
+ * runs in runner.js (which contains @rstest/core/internal/browser-runtime).
24
24
  * Without this, stack traces from inline snapshots cannot be mapped back
25
25
  * to the original source files.
26
26
  */
@@ -1,4 +1,6 @@
1
- import type { Rstest } from '@rstest/core/browser';
1
+ import { getNumCpus, parseWorkers } from '@rstest/core/internal/browser';
2
+ import type { Rstest } from '@rstest/core/internal/browser';
3
+ export { getNumCpus, parseWorkers };
2
4
  type HeadlessConcurrencyContext = Pick<Rstest, 'command'> & {
3
5
  normalizedConfig: {
4
6
  pool: {
@@ -6,7 +8,5 @@ type HeadlessConcurrencyContext = Pick<Rstest, 'command'> & {
6
8
  };
7
9
  };
8
10
  };
9
- export declare const parseWorkers: (maxWorkers: string | number, numCpus?: number) => number;
10
11
  export declare const resolveDefaultHeadlessWorkers: (command: HeadlessConcurrencyContext['command'], numCpus?: number) => number;
11
12
  export declare const getHeadlessConcurrency: (context: HeadlessConcurrencyContext, totalTests: number) => number;
12
- export {};
@@ -1,2 +1,2 @@
1
- import type { Rstest } from '@rstest/core/browser';
2
- export declare const validateBrowserConfig: (context: Rstest) => void;
1
+ import type { RstestContext } from '@rstest/core/internal/browser';
2
+ export declare const validateBrowserConfig: (context: RstestContext) => void;
@@ -1,4 +1,4 @@
1
- import type { Reporter } from '@rstest/core/browser';
1
+ import type { Reporter } from '@rstest/core/internal/browser';
2
2
  import { HostDispatchRouter } from './dispatchRouter.js';
3
3
  import type { BrowserClientMessage, BrowserDispatchHandler, SnapshotRpcRequest } from './protocol.js';
4
4
  export type HostDispatchRouterOptions = ConstructorParameters<typeof HostDispatchRouter>[0];
@@ -1,4 +1,4 @@
1
- import { type BrowserTestRunOptions, type BrowserTestRunResult, type ListCommandResult, type Rstest } from '@rstest/core/browser';
1
+ import { type BrowserTestRunOptions, type BrowserTestRunResult, type ListCommandResult, type RstestContext } from '@rstest/core/internal/browser';
2
2
  type LazyCompilationModule = {
3
3
  nameForCondition?: () => string | null | undefined;
4
4
  };
@@ -26,7 +26,7 @@ export declare const createBrowserRsbuildDevConfig: (_isWatchMode: boolean) => {
26
26
  logLevel: 'error';
27
27
  };
28
28
  };
29
- export declare const runBrowserController: (context: Rstest, options?: BrowserTestRunOptions) => Promise<BrowserTestRunResult | void>;
29
+ export declare const runBrowserController: (context: RstestContext, options?: BrowserTestRunOptions) => Promise<BrowserTestRunResult | void>;
30
30
  /**
31
31
  * Result from collecting browser tests.
32
32
  * This is the return type for listBrowserTests, designed for future extraction
@@ -41,7 +41,7 @@ export type ListBrowserTestsResult = {
41
41
  * This function creates a headless browser runtime, loads test files,
42
42
  * and collects their test structure (describe/test declarations).
43
43
  */
44
- export declare const listBrowserTests: (context: Rstest, options?: {
44
+ export declare const listBrowserTests: (context: RstestContext, options?: {
45
45
  shardedEntries?: Map<string, {
46
46
  entries: Record<string, string>;
47
47
  }>;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { BrowserTestRunOptions, BrowserTestRunResult, Rstest } from '@rstest/core/browser';
1
+ import type { BrowserTestRunOptions, BrowserTestRunResult, RstestContext } from '@rstest/core/internal/browser';
2
+ import { validateBrowserConfig } from './configValidation.js';
2
3
  import { type ListBrowserTestsResult } from './hostController.js';
3
- export { validateBrowserConfig } from './configValidation.js';
4
- export { BROWSER_VIEWPORT_PRESET_DIMENSIONS, BROWSER_VIEWPORT_PRESET_IDS, resolveBrowserViewportPreset, } from './viewportPresets.js';
5
- export declare function runBrowserTests(context: Rstest, options?: BrowserTestRunOptions): Promise<BrowserTestRunResult | void>;
6
- export declare function listBrowserTests(context: Rstest): Promise<ListBrowserTestsResult>;
4
+ export { validateBrowserConfig };
5
+ export declare function runBrowserTests(context: RstestContext, options?: BrowserTestRunOptions): Promise<BrowserTestRunResult | void>;
6
+ export declare function listBrowserTests(context: RstestContext, options?: Pick<BrowserTestRunOptions, 'shardedEntries'>): Promise<ListBrowserTestsResult>;
7
7
  export type { BrowserTestRunOptions, BrowserTestRunResult, ListBrowserTestsResult, };