upgrade-support icon indicating copy to clipboard operation
upgrade-support copied to clipboard

RangeError: Invalid string length

Open boksandaniel opened this issue 9 months ago • 2 comments

Since upgrading the RN from 0.75.4 to 0.77.0 I'm encountering snapshots fails when I run these kind of tests.

it('ExampleTest - default', () => { const tree = render( <ThemeProvider> <ExampleTest /> </ThemeProvider> ).toJSON();

expect(tree).toMatchSnapshot();

});

  44 |     ).toJSON();
  45 |
> 46 |     expect(tree).toMatchSnapshot();
     |                  ^
  47 |   });

at printObjectProperties (node_modules/pretty-format/build/collections.js:170:47) at key (node_modules/pretty-format/build/index.js:386:38) at AsymmetricMatcher (node_modules/pretty-format/build/index.js:469:3) at printObjectProperties (node_modules/pretty-format/build/collections.js:169:21) at key (node_modules/pretty-format/build/index.js:386:38) at AsymmetricMatcher (node_modules/pretty-format/build/index.js:469:3) at printObjectProperties (node_modules/pretty-format/build/collections.js:169:21) at key (node_modules/pretty-format/build/index.js:386:38) at AsymmetricMatcher (node_modules/pretty-format/build/index.js:469:3) at printObjectProperties (node_modules/pretty-format/build/collections.js:169:21) at key (node_modules/pretty-format/build/index.js:386:38) at AsymmetricMatcher (node_modules/pretty-format/build/index.js:469:3) at printObjectProperties (node_modules/pretty-format/build/collections.js:169:21) at key (node_modules/pretty-format/build/index.js:386:38)

boksandaniel avatar Feb 19 '25 10:02 boksandaniel

Facing the same problem. Did you get it working?

In my case, it seems to be related to react-native-reanimated version 3.16.0

JoaoMosmann avatar Apr 30 '25 14:04 JoaoMosmann

It seems it was created by excluding the mock files needed in Jest: https://github.com/facebook/react-native/pull/51530

I have no work-around yet.

jerone avatar May 26 '25 08:05 jerone