plotly / plotly/react-plotly.js
testing with create-react-app
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 138
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 4
Description
Hi! Thanks for all the good work.
I am trying to make the simple test that comes with create-react-app to work. (Which checks whole app renders without a crash)
I get an error like below.
TypeError: Cannot read property 'document' of undefined
at node_modules/plotly.js/dist/plotly.js:74:22
at node_modules/plotly.js/dist/plotly.js:9620:2
at Object.<anonymous>._$numerical_517.BADNUM (node_modules/plotly.js/dist/plotly.js:7:88)
at Object.<anonymous> (node_modules/plotly.js/dist/plotly.js:7:327)
at Object.<anonymous> (node_modules/react-plotly.js/react-plotly.js:11:15)
at Object.<anonymous> (src/components/Graph/StyledGraph.js:2:20)
at Object.<anonymous> (src/components/Graph/index.js:4:20)
at Object.<anonymous> (src/container/GraphContainer.js:6:14)
at Object.<anonymous> (src/App.js:7:23)
at Object.<anonymous> (src/Main.js:14:12)
at Object.<anonymous> (src/App.test.js:5:13)
I am using pretty much the default command that comes with create-react-app. (Test command node scripts/test.js --env=jsdom, react-app-preset)
import Plotly from 'plotly.js/dist/basic';
I am using Plotly like below.
import Plotly from 'plotly.js/dist/basic';
import createPlotlyComponent from 'react-plotly.js/factory';
const Plot = createPlotlyComponent(Plotly);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the create-react-app test command and inspect the stack from src/App.test.js through src/App.js, src/container/GraphContainer.js, src/components/Graph/index.js, and src/components/Graph/StyledGraph.js. Compare the Plotly imports and react-plotly.js factory usage with the jsdom test environment. Done means the default render test runs without the document-related error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- data-visualization, frontend, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100