plotly / plotly/react-plotly.js

testing with create-react-app

Đang mở
#74 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
JavaScript
Star
1.1k
Fork
138
Merge trung bình
3 ngày 2 giờ
Pull request đã merge (30 ngày)
4

Mô tả

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);

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện lỗi bằng lệnh kiểm thử của create-react-app và kiểm tra stack từ src/App.test.js qua src/App.js, src/container/GraphContainer.js, src/components/Graph/index.js và src/components/Graph/StyledGraph.js. So sánh các import của Plotly và cách sử dụng factory của react-plotly.js với môi trường kiểm thử jsdom. Được xem là hoàn tất khi bài kiểm thử render mặc định chạy mà không gặp lỗi liên quan đến document.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, react
Lĩnh vực
data-visualization, frontend, testing
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.