Commit b8b5a92
Fix RSC test infrastructure: Convert jest.setup.js to ESM and re-enable tests (#2124)
Fixes #2122
- Convert `jest.setup.js` from CommonJS `require()` to ESM imports for
compatibility with ESM mode
- Re-enable RSC tests with automatic React version detection
- Remove unnecessary `script/convert` override since `package.json` now
handles version checking automatically
Moved `require()` statements to top-level ESM imports:
- `import { TextEncoder, TextDecoder } from 'util'`
- `import { Readable } from 'stream'`
- `import { ReadableStream, ReadableStreamDefaultReader } from
'stream/web'`
- `import { jest } from '@jest/globals'`
Re-enabled `test:rsc` script with React version detection:
- Tests run normally on React 19+ where RSC features are available
- Tests skip gracefully on React 18 with informative message: `RSC tests
skipped (requires React 19+, found 18.0.0)`
Removed the override that disabled RSC tests since the version check is
now built into `package.json`.
- [x] Run `yarn test` in `packages/react-on-rails-pro` - passes with
React 18 (RSC tests skipped)
- [x] Verify RSC tests will run on React 19 in CI
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
* **Chores**
* Updated RSC test infrastructure to conditionally run based on React
version; tests now execute for React 19+ and skip for earlier versions.
* Modernized Jest setup configuration to use ES module imports instead
of dynamic requires, improving compatibility with modern JavaScript
standards.
<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude <[email protected]>1 parent 3ef26ab commit b8b5a92
File tree
5 files changed
+45
-14
lines changed- packages/react-on-rails-pro
- scripts
- tests
- script
5 files changed
+45
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
1 | 4 | | |
2 | 5 | | |
3 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
2 | 7 | | |
3 | 8 | | |
| |||
11 | 16 | | |
12 | 17 | | |
13 | 18 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
0 commit comments