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

Cannot find module 'react-test-renderer' from 'test-bodies.js' when running tests #1409

Closed
wallslide opened this issue Jul 5, 2017 · 5 comments

Comments

@wallslide
Copy link

image

I have @storybook/react 3.1.7 installed. My project is based on creact-react-app. I setup storyshots based on the instructions here:
https://github.com/storybooks/storybook/tree/master/addons/storyshots

First I added @storybook/addon-storyshots (version 3.1.7 was installed), then I created Storyshots.test.js as instructed, and ran yarn run test. My storybook config folder is the default one.

I'm running it in a docker container whose base is the node:7.9 docker image.

@wallslide
Copy link
Author

Fixed this by just explicitly adding the react-test-renderer package to my dev dependencies.

@xavxyz xavxyz closed this as completed Jul 15, 2017
@oximer
Copy link

oximer commented Oct 3, 2017

I'm having the same error, even after adding react-test-renderer

@techieshark
Copy link
Contributor

Adding to the comment from @wallslide above -

According to these docs,

StoryShots addon for React is dependent on react-test-renderer, but doesn't install it, so you need to install it separately.

npm install --save-dev react-test-renderer

(If using Angular or Vue you'll need another package; see the docs I link to.)

@Senja20
Copy link

Senja20 commented Dec 5, 2022

the command npm install --save-dev react-test-renderer worked for me (thanks @techieshark ), but I had to use --legacy-peer-deps at the end. Also, I was working using typescript therefore I had to install types for react-test-renderer using the following command npm i --save-dev @types/react-test-renderer.

Commands:

  • npm install --save-dev react-test-renderer --legacy-peer-deps
  • npm i --save-dev @types/react-test-renderer (if ts)

@ghermaico135
Copy link

when I install this => npm install --save-dev react-test-renderer --legacy-peer-deps the testing works.
Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants