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
When we want to use "toMatchSnapshot" with LWC and Jest, we could have the following error (when some properties of the JSON have got a null value):
PrettyFormatPluginError: Cannot destructure property `nodeType` of 'undefined' or 'null'.TypeError: Cannot destructure property `nodeType` of 'undefined' or 'null'.
at Object.test (node_modules/@lwc/jest-serializer/src/index.js:12:14)
at __EXTERNAL_MATCHER_TRAP__ (node_modules/expect/build/index.js:342:30)
at Object.expect [as toMatchSnapshot] (node_modules/expect/build/index.js:343:15)
at it.each (src/main/modules/search_lightning/searchResultsAuraAdapter/__tests__/modelMapper.test.js:88:13)
Hi
When we want to use "toMatchSnapshot" with LWC and Jest, we could have the following error (when some properties of the JSON have got a null value):
When we look on the code, we have:
According to ES6, the default value is applied only if the parameter is undefined. If we have a null value, it will not be applied.
Then, we should made instead:
Should I create a PR?
Many thanks
Regards
The text was updated successfully, but these errors were encountered: