@rstest/browser-react 0.10.4 → 0.10.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.
package/dist/act.d.ts CHANGED
@@ -2,7 +2,5 @@ type ActFunction = (callback: () => unknown) => Promise<void>;
2
2
  /**
3
3
  * Wraps a callback in React's act() for proper state updates.
4
4
  * Automatically manages IS_REACT_ACT_ENVIRONMENT.
5
- */
6
- export declare const act: ActFunction;
7
- export {};
8
- //# sourceMappingURL=act.d.ts.map
5
+ */ export declare const act: ActFunction;
6
+ export { };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import { act, cleanup, configure, render, renderHook } from './pure.js';
2
- export type { RenderConfiguration, RenderHookOptions, RenderHookResult, RenderOptions, RenderResult, } from './pure.js';
2
+ export type { RenderConfiguration, RenderHookOptions, RenderHookResult, RenderOptions, RenderResult } from './pure.js';
3
3
  export { act, cleanup, configure, render, renderHook };
4
- //# sourceMappingURL=index.d.ts.map
package/dist/pure.d.ts CHANGED
@@ -1,63 +1,46 @@
1
1
  import type { JSXElementConstructor, ReactNode } from 'react';
2
2
  import { act } from './act.js';
3
+ // ===== Types =====
3
4
  export interface RenderResult {
4
- /** The container element the component is rendered into */
5
- container: HTMLElement;
6
- /** The base element for queries, defaults to document.body */
7
- baseElement: HTMLElement;
8
- /** Unmount the rendered component */
9
- unmount: () => Promise<void>;
10
- /** Re-render the component with new props/element */
11
- rerender: (ui: ReactNode) => Promise<void>;
12
- /** Returns the rendered UI as a DocumentFragment (useful for snapshots) */
13
- asFragment: () => DocumentFragment;
5
+ /** The container element the component is rendered into */ container: HTMLElement;
6
+ /** The base element for queries, defaults to document.body */ baseElement: HTMLElement;
7
+ /** Unmount the rendered component */ unmount: () => Promise<void>;
8
+ /** Re-render the component with new props/element */ rerender: (ui: ReactNode) => Promise<void>;
9
+ /** Returns the rendered UI as a DocumentFragment (useful for snapshots) */ asFragment: () => DocumentFragment;
14
10
  }
15
11
  export interface RenderOptions {
16
- /** Custom container element to render into */
17
- container?: HTMLElement;
18
- /** Base element for queries, defaults to document.body */
19
- baseElement?: HTMLElement;
20
- /** Wrapper component (e.g., for providers/context) */
21
- wrapper?: JSXElementConstructor<{
12
+ /** Custom container element to render into */ container?: HTMLElement;
13
+ /** Base element for queries, defaults to document.body */ baseElement?: HTMLElement;
14
+ /** Wrapper component (e.g., for providers/context) */ wrapper?: JSXElementConstructor<{
22
15
  children: ReactNode;
23
16
  }>;
24
17
  }
25
18
  export interface RenderHookOptions<Props> extends RenderOptions {
26
- /** Initial props passed to the hook */
27
- initialProps?: Props;
19
+ /** Initial props passed to the hook */ initialProps?: Props;
28
20
  }
29
21
  export interface RenderHookResult<Result, Props> {
30
- /** Reference to the latest hook return value */
31
- result: {
22
+ /** Reference to the latest hook return value */ result: {
32
23
  current: Result;
33
24
  };
34
- /** Re-render the hook with new props */
35
- rerender: (props?: Props) => Promise<void>;
36
- /** Unmount the hook */
37
- unmount: () => Promise<void>;
38
- /** Access to act for manual state updates */
39
- act: (callback: () => unknown) => Promise<void>;
25
+ /** Re-render the hook with new props */ rerender: (props?: Props) => Promise<void>;
26
+ /** Unmount the hook */ unmount: () => Promise<void>;
27
+ /** Access to act for manual state updates */ act: (callback: () => unknown) => Promise<void>;
40
28
  }
41
29
  export interface RenderConfiguration {
42
- /** Enable React StrictMode wrapper */
43
- reactStrictMode: boolean;
30
+ /** Enable React StrictMode wrapper */ reactStrictMode: boolean;
44
31
  }
32
+ // ===== Public API =====
45
33
  /**
46
34
  * Render a React element into the DOM.
47
- */
48
- export declare function render(ui: ReactNode, options?: RenderOptions): Promise<RenderResult>;
35
+ */ export declare function render(ui: ReactNode, options?: RenderOptions): Promise<RenderResult>;
49
36
  /**
50
37
  * Render a custom React hook for testing.
51
- */
52
- export declare function renderHook<Props, Result>(renderCallback: (props?: Props) => Result, options?: RenderHookOptions<Props>): Promise<RenderHookResult<Result, Props>>;
38
+ */ export declare function renderHook<Props, Result>(renderCallback: (props?: Props) => Result, options?: RenderHookOptions<Props>): Promise<RenderHookResult<Result, Props>>;
53
39
  /**
54
40
  * Cleanup all mounted components.
55
41
  * Call this in beforeEach or afterEach to prevent test pollution.
56
- */
57
- export declare function cleanup(): Promise<void>;
42
+ */ export declare function cleanup(): Promise<void>;
58
43
  /**
59
44
  * Configure render behavior.
60
- */
61
- export declare function configure(customConfig: Partial<RenderConfiguration>): void;
45
+ */ export declare function configure(customConfig: Partial<RenderConfiguration>): void;
62
46
  export { act };
63
- //# sourceMappingURL=pure.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstest/browser-react",
3
- "version": "0.10.4",
3
+ "version": "0.10.6",
4
4
  "description": "React component testing support for Rstest browser mode",
5
5
  "keywords": [
6
6
  "rstest",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/web-infra-dev/rstest",
17
+ "url": "git+https://github.com/web-infra-dev/rstest.git",
18
18
  "directory": "packages/browser-react"
19
19
  },
20
20
  "license": "MIT",
@@ -38,19 +38,19 @@
38
38
  "dist"
39
39
  ],
40
40
  "devDependencies": {
41
- "@rslib/core": "0.22.0",
41
+ "@rslib/core": "0.23.0",
42
42
  "@types/react": "^19.2.17",
43
43
  "@types/react-dom": "^19.2.3",
44
44
  "react": "^19.2.7",
45
45
  "react-dom": "^19.2.7",
46
46
  "typescript": "^6.0.3",
47
- "@rstest/tsconfig": "0.0.1",
48
- "@rstest/core": "0.10.4"
47
+ "@rstest/core": "0.10.6",
48
+ "@rstest/tsconfig": "0.0.1"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": "^18.0.0 || ^19.0.0",
52
52
  "react-dom": "^18.0.0 || ^19.0.0",
53
- "@rstest/core": "^0.10.4"
53
+ "@rstest/core": "^0.10.6"
54
54
  },
55
55
  "engines": {
56
56
  "node": "^20.19.0 || >=22.12.0"
@@ -62,7 +62,6 @@
62
62
  "scripts": {
63
63
  "build": "rslib build",
64
64
  "dev": "cross-env SOURCEMAP=true rslib build --watch",
65
- "test": "rstest",
66
- "typecheck": "pnpm -w exec tsc --noEmit -p packages/browser-react/tsconfig.json"
65
+ "test": "rstest"
67
66
  }
68
67
  }
package/dist/act.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"act.d.ts","sourceRoot":"","sources":["../src/act.ts"],"names":[],"mappings":"AAmBA,KAAK,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,GAAG,EAAE,WAcX,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAQrE,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pure.d.ts","sourceRoot":"","sources":["../src/pure.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG9D,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAI5B,MAAM,WAAW,YAAY;IAC3B,2DAA2D;IAC3D,SAAS,EAAE,WAAW,CAAC;IACvB,8DAA8D;IAC9D,WAAW,EAAE,WAAW,CAAC;IACzB,qCAAqC;IACrC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,qDAAqD;IACrD,QAAQ,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,OAAO,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