Make sure `no-unnecessary-act` detects unnecessary `act` called before the `render` method
See original GitHub issueWhat rule do you want to change?
no-unnecessary-act
Does this change cause the rule to produce more or fewer warnings?
More warnings
How will the change be implemented?
I don’t have a plan to implement the change yet.
The idea is to improve the rule no-unnecessary-act
so it can detect unnecessary act
which are called before a render.
https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-unnecessary-act.md
Those unnecessary make the codebase noisy.
Example code
act(() => {
someSetupMethod();
});
render(<Example />);
How does the current rule affect the code?
This unnecessary act
is not detected
How will the new rule affect the code?
This unnecessary act
is detected
Anything else?
No response
Do you want to submit a pull request to change the rule?
Yes, but need help
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top Results From Across the Web
eslint-plugin-testing-library/no-unnecessary-act.md at main
Disallow wrapping Testing Library utils or empty callbacks in act ( testing-library/no-unnecessary-act ). This rule is enabled in the following configs: ...
Read more >React Testing Library and the “not wrapped in act” Errors
I recently upgraded React and React testing library. Very happy about the upgrade. But I start to see test errors like this: In...
Read more >How To Test a React App with Jest and React Testing Library
Inside the function, there is a render method that React Testing Library provides to render your component into the DOM. With the component ......
Read more >"React has detected a change in the order of Hooks" but ...
That causes react to treat the hook calls inside the function as part of ... and not being called before because of conditional...
Read more >You Probably Don't Need act() in Your React Tests
In most cases, react-testing-library makes wrapping test code in act() unnecessary. Furthermore, doing so might cause additional problems.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
yeah definitely
yeah seems legit
Thank you 👍