Rangeerror: Invalid string length
See original GitHub issueTrying to run Jest tests, but it’s failing with an error. I am trying to do snapshot testing but it fails with
RangeError: Invalid string length
at printObjectProperties (node_modules/pretty-format/build/collections.js:172:47)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
at printComplexValue (node_modules/pretty-format/build/index.js:281:48)
at printer (node_modules/pretty-format/build/index.js:364:10)
at printObjectProperties (node_modules/pretty-format/build/collections.js:171:21)
This is one of the test that keeps failing:
it('snapshot testing', () => {
const demoItem = mountWithIntl(<DemoItem store={testStore} demoUnchange={jest.fn()} demoReply={demoReply} demoRef={jest.fn()} />);
expect(toJson(demoItem)).toMatchSnapshot();
});
My package.json has this Jest configuration:
"jest": {
"verbose": true,
"snapshotSerializers": [
"enzyme-to-json/serializer"
]
}
- “enzyme”: “^3.9.0”
- “enzyme-adapter-react-16”: “^1.10.0”
- “enzyme-react-intl”: “^2.0.3”
- “enzyme-redux”: “^0.2.1”
- “enzyme-to-json”: “^3.3.5”
- “babel-jest”: “^24.1.0”
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Uncaught RangeError: Invalid string length when appending ...
Your 2-D array accesses are incorrect, but the main problem is that you're re-using the variable i in an inner loop: for (i...
Read more >RangeError: Invalid string length with large files. · Issue #35973
When i'm trying to read a large Json File (700MB - 26.640.222 lines) using ReadStream i'm getting the error: "RangeError: Invalid string length" ......
Read more >RangeError: invalid array length - JavaScript - MDN Web Docs
The JavaScript exception "Invalid array length" occurs when specifying an array length that is either negative, a floating number or exceeds ...
Read more >Simplest solution to JSON.stringify RangeError: Invalid string ...
stringify RangeError: Invalid string length. We often come across this issue where the object or value passed to JSON.
Read more >HTML : Uncaught RangeError: Invalid string length ... - YouTube
HTML : Uncaught RangeError : Invalid string length when appending to a string in JavaScript [ Beautify Your Computer ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
same problem on React Native 0.63
Hi, i am facing this error on React Native 0.63, any possible fixes for this? Can’t find any proper solutions online.