question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Testing] Upgrading to 1.1.0 and above causes tests to fail, Javascript heap out of memory

See original GitHub issue

Description

I upgraded react-md from 1.0.19 to 1.1.0 and ran into these issues, I just tried upgrading to 1.1.5 and still ran into the issues. I initialized the app using create-react-app and have never had any issues like this. It appears the issue is occurring in snapshot tests that I’m using enzyme to shallow render with the aid of enzyme-to-json. The issue isn’t with either of the testing methods, as I tried downgrading and the issues disappeared. I’ve dug around and found an issue where jest can experience memory leaks when running tests with the --coverage flag but I’m experiencing the issue whether I run it with or without the flag.

I understand that this issue may be a problem with my app, and if that is the case I apologize for asking for help here. However, as the issue disappears when I downgrade back to 1.0.19 I believe it may be related to a change, though I can’t seem to pinpoint the source of the problem.

If anyone has any idea where the problem could be, I would greatly appreciate any pointers.

EDIT: I believe the issue is related to this issue in Jest.

EDIT 2: I’ve pinpointed the issue to snapshot tests for components that contain either the Menu or SelectField components. Could this issue be related to the recent ‘smart’ positioning menus?

Images/Screenshots

image image After downgrading, the tests pass again. image

Version

  • React - 15.6.1
  • React-MD - 1.1.5, but issue first seen in 1.1.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mlaursencommented, Oct 20, 2017

It appears so. Setting the fixedTo prop in the Menu to {} allows the tests to work as expected. Ideally the bug I posted above will get fixed soon, but I can always update the default props for fixedTo to be typeof window !== 'undefined' && (typeof global === 'undefined' || window !== global) ? window : {} which would solve it for now.

1reaction
Skysplitcommented, Oct 20, 2017

@Ardhimas @mlaursen Most probably this bug is caused in combination with jest-environment-jsdom. Because by default fixedTo provides full window object, generating snapshot fails due to its size (component serialization to snapshot fails miserably).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix JavaScript Heap Out of Memory Error - MakeUseOf
This error usually occurs when the default memory allocated by your system to Node. js is not enough to run a large project....
Read more >
yarn build in ReactJS, Allocation failed - JavaScript heap out ...
I tried to increase the memory for node with something like: node --max-old-space-size=8192 but there I need the name of the file that...
Read more >
How to solve JavaScript heap out of memory error
To fix JavaScript heap out of memory error, you need to add the --max-old-space-size option when running your npm command. Here's an example...
Read more >
JavaScript heap out of memory - Snyk Support
This generally occurs on larger projects where the default amount of memory allocated by Node (1.5gb) is insufficient to complete the command successfully....
Read more >
fatal error: ineffective mark-compacts near heap ... - You.com
Most times when you face this error it's probably because of a memory leak, an addition/version upgrade of a library or a difference...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found