You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/browser-react/AGENTS.md
+75-35Lines changed: 75 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,20 @@
2
2
3
3
React component testing support for Rstest browser mode. Provides `render`, `renderHook`, `cleanup`, and `act` utilities for testing React components in a real browser environment.
4
4
5
-
## Module structure
5
+
## Do
6
6
7
-
-`src/index.ts` — Default entry with auto-cleanup via `beforeEach`
8
-
-`src/pure.tsx` — Pure exports without auto-cleanup (for manual control)
9
-
-`src/act.ts` — React `act()` wrapper with `IS_REACT_ACT_ENVIRONMENT` management
7
+
- Support React 17, 18, and 19 — ensure code works across all versions
8
+
- Use `act()` for all render/unmount/state update operations
9
+
- Keep this package focused on React rendering lifecycle only
10
+
- Use JSDoc comments for public API functions
11
+
- Default to small, focused diffs
12
+
13
+
## Don't
14
+
15
+
- Don't add DOM query utilities (users should use `@testing-library/dom`)
16
+
- Don't add dependencies beyond React peer deps
17
+
- Don't break compatibility with older React versions without discussion
18
+
- Don't use React version-specific APIs without fallbacks
10
19
11
20
## Commands
12
21
@@ -15,19 +24,58 @@ React component testing support for Rstest browser mode. Provides `render`, `ren
15
24
pnpm --filter @rstest/browser-react build
16
25
pnpm --filter @rstest/browser-react dev # Watch mode
17
26
18
-
# Typecheck
19
-
pnpm --filter @rstest/browser-react typecheck
27
+
# Type check single file
28
+
pnpm tsc --noEmit src/pure.tsx
29
+
30
+
# Format single file
31
+
pnpm prettier --write src/pure.tsx
20
32
21
33
# Run tests
22
34
pnpm --filter @rstest/browser-react test
23
35
```
24
36
37
+
Note: Prefer file-scoped commands for faster feedback during development.
38
+
39
+
## Project structure
40
+
41
+
-`src/index.ts` — Default entry with auto-cleanup via `beforeEach`
No auto-cleanup, user must call `cleanup()` manually.
90
+
No auto-cleanup — user must call `cleanup()` manually.
43
91
44
-
## Usage with @testing-library/dom
45
-
46
-
This package provides React rendering utilities. For DOM queries (`getByRole`, `getByText`, etc.), users can optionally install `@testing-library/dom`:
0 commit comments