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.

bug: stencil, proxyCustomElement causing loops with pretty format plugin

See original GitHub issue

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

I’m using React 18 in combination with @testing-library/react and @ionic/react-test-utils, and I’m getting the following error: PrettyFormatPluginError: Invalid string length.

When an assertion fails, @testing-library/react will attempt to render the screen. It does so by calling a library called pretty-format with a custom formatter, whose job it is to render the current screen in a human readable way.

For some reason ionic puts this mechanism in an infinite loop,

If you manually change the printObjectProperties function at node_modules/pretty-format/build/collections.js and add some logs, you can see how many times it is called.

Also when calling screen.debug() you see the same behaviour.

Expected Behavior

You expect the “screen” to be able to render when using @testing-library/react.

This did not happen in previous versions.

Steps to Reproduce

In the reproduction repo.

Run npm install Run npm test

Focus the tests on the "blaat.test.tsx` file.

After waiting a long time it should print the error, for me it is about 120 seconds.

Code Reproduction URL

https://github.com/MrHus/ionic-react-test-fail

Ionic Info

Ionic:

Ionic CLI : 6.19.1 (/Users/redacted/.nvm/versions/node/v16.15.0/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/react 6.1.6

Capacitor:

Capacitor CLI : 3.5.1 @capacitor/android : 3.5.1 @capacitor/core : 3.5.1 @capacitor/ios : 3.5.1

Utility:

cordova-res : not installed globally native-run : 1.6.0

System:

NodeJS : v16.15.0 (/Users/redacted/.nvm/versions/node/v16.15.0/bin/node) npm : 8.5.5 OS : macOS Big Sur

Additional Information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
tonypattoncommented, Nov 3, 2022

Any update on this issue? Seems crazy that react-testing-library and react-ionic might be broken for 6 months and there is not a larger discussion here?

2reactions
vincenthongzycommented, Sep 24, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

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