Skip to content

Make RSC tests await act #1734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Make RSC tests await act #1734

wants to merge 3 commits into from

Conversation

alexeyr-ci2
Copy link
Collaborator

@alexeyr-ci2 alexeyr-ci2 commented Apr 18, 2025

Summary

Tests in node_package/tests/RSCClientRoot.test.jsx were calling act without await, leading to these warnings:

You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);

and

You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one.

Pull Request checklist


This change is Reviewable

Summary by CodeRabbit

  • Chores

    • Updated development dependencies to include new ESLint plugins for Jest DOM and Testing Library.
    • Upgraded TypeScript ESLint tooling to a newer version.
    • Enhanced linting configuration for test files with additional plugin recommendations.
    • Simplified package removal patterns in maintenance scripts.
  • Tests

    • Refined test helper logic for rendering components in test files.

Copy link
Contributor

coderabbitai bot commented Apr 18, 2025

## Walkthrough

The ESLint configuration for test files was extended to include the Testing Library plugin alongside existing Jest settings. The `eslint-plugin-testing-library` dependency was added, and the TypeScript ESLint plugin was upgraded. A test helper function was simplified by removing an async `act` wrapper. The package removal script was consolidated with broader regex patterns.

## Changes

| File(s)                          | Change Summary                                                                                   |
|---------------------------------|-------------------------------------------------------------------------------------------------|
| eslint.config.ts                 | Added `eslint-plugin-testing-library` recommended config for test files alongside Jest config. |
| package.json                    | Added `eslint-plugin-testing-library` (v7.4.0); upgraded `typescript-eslint` from 8.29.1 to 8.33.1. |
| node_package/tests/RSCClientRoot.test.jsx | Removed async `act` wrapper from `mockRSCRequest` helper’s `render` function, making it synchronous. |
| script/convert                  | Replaced multiple ESLint and Testing Library package removals with consolidated regex-based removals in package.json editing. |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant TestHelper as mockRSCRequest.render
    participant Component as RSCClientRoot

    TestHelper->>Component: Call RSCClientRoot directly (no async act)
    Note right of Component: Executes synchronously without awaiting

Possibly related PRs

Suggested reviewers

  • AbanoubGhadban
  • Judahmeek

Poem

🐇 In code’s green meadow I leap and play,
ESLint rules now brighten the way.
Testing Library hops in with cheer,
Async acts vanish, the path is clear.
Dependencies fresh, scripts refined,
A cleaner codebase, well-defined! 🌿✨


<!-- walkthrough_end -->


---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between e5700dc3703ee177bc61732c3b349567161ff2dc and a74f2983d2802454f797c5063e9adb5924547dd8.

</details>

<details>
<summary>⛔ Files ignored due to path filters (1)</summary>

* `yarn.lock` is excluded by `!**/yarn.lock`, `!**/*.lock`

</details>

<details>
<summary>📒 Files selected for processing (3)</summary>

* `eslint.config.ts` (2 hunks)
* `package.json` (1 hunks)
* `script/convert` (1 hunks)

</details>

<details>
<summary>✅ Files skipped from review due to trivial changes (1)</summary>

* package.json

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (2)</summary>

* eslint.config.ts
* script/convert

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (5)</summary>

* GitHub Check: dummy-app-integration-tests (oldest)
* GitHub Check: dummy-app-integration-tests (newest)
* GitHub Check: rspec-package-tests (oldest)
* GitHub Check: rspec-package-tests (newest)
* GitHub Check: build

</details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAWTQAaw8bAGUAYTCQ5DQAd21QtDFo9Fpaf0REaXQsJAcPeCxcWA8aRFCAM3hIyAADDEUSAH1uQo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kGM0JUrqfShRvFqedf7kQRQfWFAywGkoXhiyl2KEFGBfuQdBH0yq8oMCO+AGaJiPTLJwLl9CoWMOaqtFhQMQYDNlQYFCvaMphjHr2TZiB8BLB4l/EMF7ujMkkDI7AUEejAWgYMDGQxHpi2vNGUu3ItH4CkMSUQZJYG2qcv4b2UQ9WDnRkW3osoJhkcFYBjA2SfRejQPYf4WdLy/EtT5fAU6+D+FIDsHg1BfRIO5NjFsVRJ5CfwYiK1aA2CbNwNoICMRnXRFBCkSEXRnABNUr8kg2iXggPqj0AAArbT11dfYsCpoFcz7rLMgwmP4c4/ljj+DDIUKI5rWMcm6PxkWMTJ042aLGGuRMjzXGGn/MzFnvLVw1ZmEqYJekGew0ZgZPRogZ1TaOsAandS9GiKZ51V7EnUGiIVrLzrZbhUiiESrpTitxeVlZ2KjX/1ZfszPD18WnMuaKG51L2jU7IEqCMZ9N4QLoU8wwbz8gUwAW47xoTuARP51Nt26TAr0KGdvA4WyfMstECkgIIzHWssJHRNwC70Rt1mQ62nLrzhknNBy9IfR9wiBXqWJV3bynLRv1oCs1LWFjGnHPRmokDQcJ4VxKWkS8yVNG3uWIf9KRnRjH5ZQIkWjlMbIRGwCFs7vrzrpXC5dADV2LuRafCB5LMVUpxVwgwB7p3crKhVKqt9ar1XUo1Jhz7tbJ02n4XI1kpUaKOsoUaZ0JqXW5xrdQgwZGIEGL4kgH9aCDDgt2C6XPpoVuDc2qtJAABsZuGBhoDcGgArAwZtaBbe0AYAG8tAbbcCGbeW9otbm229tx7qtDv6327Dfr661VA9hrDS75tAaw3NpICQetAaA0CAYGb1PJuHde+DTW23ZuA31qzxyqtLuI/c7QDb33Nby3NtoFW8tYaq12+De0ANNaA0MFt2Gs3Sea1mgELbmtrfbfBoDaUctEfI8KFYMr1X6uJzLC14MGq+ugA -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=shakacode/react_on_rails&utm_content=1734):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@alexeyr-ci alexeyr-ci force-pushed the alexeyr/fix-rsc-tests branch 4 times, most recently from 5e381b4 to 9ec8d5f Compare April 27, 2025 14:48
@alexeyr-ci alexeyr-ci force-pushed the alexeyr/fix-rsc-tests branch from 9ec8d5f to 11d72c2 Compare April 27, 2025 14:57
@alexeyr-ci2 alexeyr-ci2 marked this pull request as ready for review June 6, 2025 11:55
@alexeyr-ci alexeyr-ci force-pushed the alexeyr/fix-rsc-tests branch from e5700dc to a74f298 Compare June 7, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants