Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rangeerror: Invalid string length #8109

Closed
heartlash opened this issue Mar 12, 2019 · 7 comments
Closed

Rangeerror: Invalid string length #8109

heartlash opened this issue Mar 12, 2019 · 7 comments
Labels

Comments

@heartlash
Copy link

heartlash commented Mar 12, 2019

Trying 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"
@SimenB
Copy link
Member

SimenB commented Mar 12, 2019

Could you put together a reproduction?

/cc @pedrottimark

@pedrottimark
Copy link
Contributor

Yes, a minimal repo helps a lot in situation like this. Here is something I don’t see in the config:

To run the setup file to configure Enzyme and the Adapter with Jest … setupFilesAfterEnv

https://airbnb.io/enzyme/docs/guides/jest.html#configure-with-jest

@heartlash
Copy link
Author

Guys, appreciate your help. We have decided to stick to babel 6 for now. We are reverting changes. I am closing this issue.

@StarryFire
Copy link

Hi, i am facing this error on React Native 0.63, any possible fixes for this? Can't find any proper solutions online.

@JossanPetrenko
Copy link

same problem on React Native 0.63

@raimonkh
Copy link

raimonkh commented Feb 2, 2021

Can also report this is a problem on the following:

    "react": "16.13.1",
     "react-native": "0.63.4",
    "jest": "24.9",

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants