Open handles when testing with jest
Hi, when I run component tests with jest there are open handles which keep jest from exiting. Running jest with --detectOpenHandles I get the following output:
> 5 | import { Provider } from "react-native-paper";
| ^
at ../node_modules/react-native/node_modules/scheduler/cjs/scheduler.development.js:178:17
at Object.<anonymous> (../node_modules/react-native/node_modules/scheduler/cjs/scheduler.development.js:13:3)
at Object.<anonymous> (../node_modules/react-native/node_modules/scheduler/index.js:6:20)
at ../node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:23:17
at Object.<anonymous> (../node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:17:3)
at Object.<anonymous> (../node_modules/react-native/Libraries/Renderer/shims/ReactNative.js:21:17)
at Object.<anonymous> (../node_modules/react-native/Libraries/Animated/AnimatedEvent.js:16:21)
at Object.<anonymous> (../node_modules/react-native/Libraries/Animated/AnimatedMock.js:13:44)
at Object.<anonymous> (../node_modules/react-native/Libraries/Animated/Animated.js:19:22)
at Object.Animated (../node_modules/react-native/index.js:260:12)
at Object.<anonymous> (../node_modules/react-native-paper/lib/commonjs/components/BottomNavigation/BottomNavigationRouteScreen.tsx:27:16)
at Object.<anonymous> (../node_modules/react-native-paper/lib/commonjs/components/BottomNavigation/BottomNavigation.tsx:26:1)
at Object.<anonymous> (../node_modules/react-native-paper/lib/commonjs/index.tsx:25:1)
- react-native-paper: 4.12.4
- react-native-vector-icons: 9.2.0
- react-native: 0.68.3
I'm using the "react-native" jest preset. I think there is nothing special in my jest setup.
Can someone help me with that?
Couldn't find version numbers for the following packages in the issue:
react-native-paperreact-native-vector-icons
Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
react-native(found:0.68.3, latest:0.69.4)
Can you verify that the issue still exists after upgrading to the latest versions of these packages?
Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a snack.expo.dev link or link to a GitHub repo under your username).
Can you provide a minimal repro which demonstrates the issue? A repro will help us debug the issue faster. Please try to keep the repro as small as possible and make sure that we can run it without additional setup.
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
react-native(found:0.68.3, latest:0.69.4)
Can you verify that the issue still exists after upgrading to the latest versions of these packages?
Have you mocked the Animated helper? Ex: https://github.com/callstack/react-native-testing-library/blob/7dd403b2ea76df40c04b22fda91773b95d4454c7/examples/reactnavigation/jest-setup.js it helps with some cases of open handles
Yes I'm already mocking the NativeAnimatedHelper.
Thank you for your reply @thymikee.
Hello 👋, this issue has been open for more than a month without a repro or any activity. If the issue is still present in the latest version, please provide a repro or leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution or workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix it.