Enzyme: mount goes Out of Memory

Created on 2 May 2018  路  4Comments  路  Source: enzymejs/enzyme

Component: https://github.com/dowjones/react-dropdown-tree-select/blob/perf-tweaks/src/tree/index.js

Test: https://github.com/dowjones/react-dropdown-tree-select/blob/perf-tweaks/src/tree/index.test.js#L48

Branch with repro: https://github.com/dowjones/react-dropdown-tree-select/tree/perf-tweaks

React has no issues with it. Test pages (yarn demo) works fine on Chrome, Edge browsers with no issues. Only mount fails.

This test started failing after adding react-infinite-scroll-component. However, I'm not sure why. I've checked their source code and nothing stands out of the ordinary. If I take out the component, test runs fine.

Current behavior

mount(<Tree data={treeManager.tree} />) throws Out of Memory error.

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node_module_register
 2: v8::internal::FatalProcessOutOfMemory
 3: v8::internal::FatalProcessOutOfMemory
 4: v8::internal::Factory::NewUninitializedFixedArray
 5: v8::internal::WasmDebugInfo::SetupForTesting
 6: v8::internal::WasmDebugInfo::SetupForTesting
 7: v8::internal::WasmDebugInfo::SetupForTesting
 8: v8::internal::WasmDebugInfo::SetupForTesting
 9: v8::internal::SharedFunctionInfo::SetScript
10: v8::internal::JSReceiver::class_name
11: v8::internal::JSReceiver::class_name
12: v8::internal::JSReceiver::class_name
13: v8::internal::SourcePositionTableIterator::Advance
14: 0000030A229843C1

Expected behavior

Should not throw Out of memory error.

Your environment

node: v8.11.1
npm: 5.6.0

Win 10 x64

```

API

  • [ ] shallow
  • [X ] mount
  • [ ] render

Version

| library | version
| ---------------- | -------
| Enzyme | ^3.3.0
| React | ^16.0.0

Adapter

  • [x] enzyme-adapter-react-16
  • [ ] enzyme-adapter-react-15
  • [ ] enzyme-adapter-react-15.4
  • [ ] enzyme-adapter-react-14
  • [ ] enzyme-adapter-react-13
  • [ ] enzyme-adapter-react-helper
  • [ ] others ( )
Need To Reproduce bug help wanted

Most helpful comment

Hi @sstern6 , I restored the branch and also updated it with latest develop. The linked test still causes out of memory exception, so hopefully, this gives you enough for reproducing. If you skip the test, all tests complete within a few minutes.

All 4 comments

@mrchief can you paste a valid link to the component to repro please.

Hi @sstern6 , I restored the branch and also updated it with latest develop. The linked test still causes out of memory exception, so hopefully, this gives you enough for reproducing. If you skip the test, all tests complete within a few minutes.

Also having this problem

I know this is pretty old, but have there been any developments? Running into the same issue here with Enzyme 3.11.0 and Jest 26.0.1

If I increase the memory to >4GB I get string length errors

Was this page helpful?
0 / 5 - 0 ratings