Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: displayName being undefined while creating snapshot #17

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/testUtils/shallow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
} from 'react-is';
import ElementExplorer from './ElementExplorer';

const getNodeName = node => node.displayName || node.name || '';
const getNodeName = node => node?.displayName || node?.name || '';

class ReactShallowRenderer {
shallowRenderer = null;
Expand All @@ -29,7 +29,7 @@
out = new ReactShallowRenderer(Component);
} catch (error) {
if (!error.message.includes('ReactShallowRenderer')) {
console.log({ error, out });

Check warning on line 32 in src/testUtils/shallow.jsx

View workflow job for this annotation

GitHub Actions / tests

Unexpected console statement
}
out = ReactShallowRenderer.flatRender(Component);
}
Expand Down