react-native-tab-view
react-native-tab-view copied to clipboard
jest test with v2.15.1 - JavaScript heap out of memory
Current behaviour
My jest test that was working fine before started failing with
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
after the upgrade to 2.15.1
. I checked and it does not happen with 2.15.0
.
Expected behaviour
Test runs without errors.
Code sample
See repo for minimal reproduction.
Run yarn jest 'src/__tests__/TabBar.jsx'
after cloning to see issue.
Screenshots (if applicable)
--
What have you tried
Your Environment
software | version |
---|---|
ios or android | doesn't matter |
react-native | 0.62.2 |
react-native-tab-view | 2.15.1 |
react-native-gesture-handler | 1.7.0 |
react-native-reanimated | 1.13.0 |
node | 12.14.0 (running via asdf, if relevant) |
npm or yarn | yarn, 1.22.4 |
Couldn't find version numbers for the following packages in the issue:
- ``
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-gesture-handler
(found:1.6.1
, latest:1.7.0
) -
react-native-reanimated
(found:1.9.0
, latest:1.13.0
)
Can you verify that the issue still exists after upgrading to the latest versions of these packages?
Updated to latest react-native-gesture-handler
and react-native-reanimated
, problem still persists.
Hi,
We've had same issue. Not sure which logic exactly are you testing, but for us mocking react-native-tab-view
solved issue.
This is how we mocked:
import {View as mockView } from "react-native";
jest.mock("react-native-tab-view", () => ({
TabBar: mockView,
TabView: mockView
}));
I'm also getting this error. I've mocked out the library as follows
jest.mock('react-native-tab-view', () => jest.requireActual('react-native-tab-view'));
package.json is as follows
"react-native-pager-view": "^5.4.0",
"react-native-tab-view": "^3.1.1",
"react-native-gesture-handler": "^1.10.3",
"react-native-reanimated": "^2.2.0"