You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use a custom mock for CSS Modules which has been working well so far but when I upgrade from [email protected] to [email protected] or higher I get the following error on some component snapshots:
PrettyFormatPluginError: _val$hasAttribute.call is not a functionTypeError: _val$hasAttribute.call is not a function
I also tried to use identity-obj-proxy but I get the same issue.
It seems that pretty-format is giving some kind of special treatment to Proxy values when they need to be printed to the snapshot.
Last working version
Worked up to version: 26.1.0
Stopped working in version: 26.2.2 (or probably even 26.2.0)
then try to shallow render the component above using react-test-renderer/shallow:
importReactfrom'react';import{createRenderer}from'react-test-renderer/shallow';importSomeComponentfrom'./SomeComponent.jsx';test('renders other component',()=>{constrenderer=createRenderer();constresult=renderer.render(<SomeComponent/>);expect(result.getRenderOutput()).toMatchSnapshot();});
finally run the tests.
Expected behavior
For the example given above I expected a snapshot like: <OtherComponent styles={[Proxy]} /> or even better <OtherComponent styles={[CSSModule]} />
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.
💥 Regression Report
I use a custom mock for CSS Modules which has been working well so far but when I upgrade from
[email protected]
to[email protected]
or higher I get the following error on some component snapshots:I also tried to use
identity-obj-proxy
but I get the same issue.It seems that
pretty-format
is giving some kind of special treatment toProxy
values when they need to be printed to the snapshot.Last working version
Worked up to version: 26.1.0
Stopped working in version: 26.2.2 (or probably even 26.2.0)
To Reproduce
Steps to reproduce the behavior:
identity-obj-proxy
for CSS Modules as described in the docs: https://jestjs.io/docs/en/webpack#mocking-css-modules.react-test-renderer/shallow
:Expected behavior
For the example given above I expected a snapshot like:
<OtherComponent styles={[Proxy]} />
or even better<OtherComponent styles={[CSSModule]} />
Link to repl or repo (highly encouraged)
https://repl.it/repls/PurpleGregariousNasm
Run
npx envinfo --preset jest
Paste the results here:
The text was updated successfully, but these errors were encountered: