-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Error in useEffect clean up function not causing test to fail #874
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
Comments
Maybe you should reproduce your code on something like CodePen or CodeSandbox and add to your issue because when I'm testing locally the test does not pass. 😕 |
@giseleml @eps1lon I added new sample to CodeSandbox https://codesandbox.io/s/intelligent-oskar-puduj?file=/src/example.spec.js. Let me know if you need any more help on debugging this |
@jniemin Thanks for the repro. This behavior changed in React 17. I've opened facebook/react#20946 on the React repo to get clarification since I don't think that we can do anything about it in |
The behavior you're looking for is currently behind a feature flag and not accessible to open-source builds of React. I encourage you to subscribe to facebook/react#20946 to be notified about updates. We can't do anything about in |
@testing-library/react
version: 11.2.5New application created by create-react-app with dependencies
Jest version 26.6.3
JSDOM 16.4.0
Relevant code or config:
What you did:
Simple test case above
What happened:
When react useEffect cleanup function throws error, test passes when it should not.
Reproduction:
Problem description:
This test case should fail as there was error thrown in useEffect clean up, but it does not. It will log the error but test case passes.
Suggested solution:
Test should fail if cleanup function throws any errors.
The text was updated successfully, but these errors were encountered: