bug: stencil, proxyCustomElement causing loops with pretty format plugin
See original GitHub issuePrerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
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:
- Created a year ago
- Comments:14 (5 by maintainers)
Top GitHub Comments
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?
@h-sakano you can check my reply here https://github.com/ionic-team/stencil/issues/3434#issuecomment-1219548078 to see if it helps