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

React.memo with snapshot testing results in <UNDEFINED> #7883

Closed
bensampaio opened this issue Feb 13, 2019 · 2 comments · Fixed by #7891
Closed

React.memo with snapshot testing results in <UNDEFINED> #7883

bensampaio opened this issue Feb 13, 2019 · 2 comments · Fixed by #7891
Labels

Comments

@bensampaio
Copy link
Contributor

🐛 Bug Report

When a snapshot of a shallow rendered component is created, if the component renders some other component created with React.memo then it shows up as <UNDEFINED>.

To Reproduce

Steps to reproduce the behavior:

  • create a component using React.memo.
  • render that component inside some other component.
  • then write a test for that component using the shallow renderer of react and create a snapshot out of it.

Expected behavior

I would expect the component name in the snapshot to be something like <memo(ComponentName)>.

Link to repl or repo (highly encouraged)

If my description is not enough or this problem is unknown I can try to do this but I rather not do it now because of time constraints. Let me know if this is really necessary.

Run npx envinfo --preset jest

Paste the results here:

System:
    OS: macOS 10.14.3
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Binaries:
  Node: 11.6.0 - /usr/local/bin/node
  Yarn: 1.13.0 - /usr/local/bin/yarn
  npm: 6.5.0 - /usr/local/bin/npm
@thymikee
Copy link
Collaborator

Feel free to contribute this to pretty-format package in this repo :)

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants