Skip to content

Commit

Permalink
Fix forwardRef handling in snapshot tests
Browse files Browse the repository at this point in the history
Previous PR jestjs#6069 didn't actually fix the issue, as it wasn't correctly comparing the forwardRefSymbol with `element.type.$$typeof`
  • Loading branch information
camspiers committed Apr 30, 2018
1 parent 4c75933 commit 266ae0f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/pretty-format/src/plugins/react_element.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ const getType = element => {
if (element.type === fragmentSymbol) {
return 'React.Fragment';
}
if (element.type === forwardRefSymbol) {
if (typeof element.type === 'object' && element.type !== null
&& element.type.$$typeof === forwardRefSymbol) {
const functionName =
element.type.render.displayName || element.type.render.name || '';

Expand Down

0 comments on commit 266ae0f

Please sign in to comment.