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 - RangeError: Maximum call stack size exceeded

See original GitHub issue

I’m using the react-select component in my application and whenever it is referenced in my Jest tests I get an error that says “RangeError: Maximum call stack size exceeded”.

Here is a basic test I’ve written using Jest based on the react-select example.

/** @jsx React.DOM */
'use strict';
jest.autoMockOff();

var React = require("react/addons");
var Select = require("react-select");
var TestUtils = React.addons.TestUtils;

describe("Select test", function() {

    var Select = require('react-select');

    var options = [
        { value: 'one', label: 'One' },
        { value: 'two', label: 'Two' }
    ];

    function logChange(val) {
        console.log("Selected: " + val);
    }

    // Render an instance of the component
    var instance = TestUtils.renderIntoDocument(
        <Select
            name="form-field-name"
            value="one"
            options={options}
            onChange={logChange}/>
        );
});

By simplifying the test to this level, I can assume the range error is happening within react-select. I also see Issue #73 there are no tests for react-select.

Does anyone else have a similar issue? I’m quite surprised the basic example implementation of the component won’t pass a simple unit test.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

20reactions
ignivanishantcommented, Oct 12, 2015

i am getting the Maximum call stack size exceeded in react-native. please provide the solution .

Thanks in advance Nishant Singh

0reactions
mattdellcommented, Mar 25, 2015

@JedWatson Excellent. Glad I could help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Karma: How to debug a RangeError: Maximum call stack size ...
I am developing an Angular App and use Jasmine with Karma in my Unit testing. In one of my component specs ...
Read more >
RangeError: Maximum call stack size exceeded with .toBe on ...
node.js doesn't seem to like really long strings. I'm able to reproduce the bug and I think I found a fix. But testing...
Read more >
RangeError: Maximum call stack size exceeded - Educative.io
The most common source for this error is infinite recursion. You must have a recursive function in your code whose base case is...
Read more >
Jest crashes with error: Maximum call stack size exceeded on ...
Click an arrow to run a test · WebStorm shows the result of the test · In the Run window I get the...
Read more >
JavaScript Error: Maximum Call Stack Size Exceeded
If you see the “Maximum Call Stack Size Exceeded” error, there's likely a problem with a recursive function within your JavaScript code.
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