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

Replaced findDomNode with ref in order to use react-test-renderer for snapshot testing with storybook #152

Merged
merged 3 commits into from
Jul 11, 2017

Conversation

acailly
Copy link

@acailly acailly commented Jun 28, 2017

I tried to use storyshots which uses react-test-renderer for snapshot testing.
Unfortunately findDomNode is not supported by react-test-renderer, but there is an alternative that works well: use a React ref.

More info on this incompatibility here: facebook/react#7371

I've included another PR of mine in order to be able to test on windows: #141

@jerairrest
Copy link
Collaborator

Thanks for the contribution!

@jerairrest jerairrest merged commit aee5336 into reactchartjs:master Jul 11, 2017
@xogeny
Copy link

xogeny commented Jul 19, 2017

I'm unclear, does this actually allow snapshot testing. When I try to use react-test-renderer with version 2.5.1, I still get errors like this from deep inside react-test-renderer implying that it is unhappy when it isn't running in a browser. Am I missing something?

 ● Plots - No Points

    TypeError: Cannot read property 'length' of null

      at Object.acquireContext (node_modules/chart.js/src/platforms/platform.dom.js:189:19)
      at Chart.construct (node_modules/chart.js/src/core/core.controller.js:72:27)
      at new Chart (node_modules/chart.js/src/core/core.js:7:8)
      at ChartComponent.renderChart (node_modules/react-chartjs-2/lib/index.js:303:29)
      at ChartComponent.componentDidMount (node_modules/react-chartjs-2/lib/index.js:124:12)
      at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:264:25
      at measureLifeCyclePerf (node_modules/react-test-renderer/lib/ReactCompositeComponent.js:75:12)
      at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:263:11

@MOZGIII
Copy link

MOZGIII commented Jan 15, 2018

Same error. Any idea on how to fix it?

@glubb92
Copy link

glubb92 commented Jul 4, 2018

We are running into the same issue. Does somebody have an idea how to fix it?

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

Successfully merging this pull request may close these issues.

5 participants