react-native-tab-view icon indicating copy to clipboard operation
react-native-tab-view copied to clipboard

jest test with v2.15.1 - JavaScript heap out of memory

Open myklosbotond opened this issue 4 years ago • 4 comments

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

myklosbotond avatar Aug 19 '20 10:08 myklosbotond

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?

github-actions[bot] avatar Aug 19 '20 10:08 github-actions[bot]

Updated to latest react-native-gesture-handler and react-native-reanimated, problem still persists.

myklosbotond avatar Aug 19 '20 10:08 myklosbotond

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
}));

mralj avatar Dec 04 '20 09:12 mralj

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"

getinnocuous avatar Aug 01 '21 15:08 getinnocuous