Cannot run jsdom unit tests for files that import Plotly due to missing browser functions
還沒有人認領這個 Issue。
- 主要語言
- JavaScript
- 星號
- 18.3k
- 分支
- 2k
- 平均合併
- 2 天 12 小時
- 30 天內合併 PR
- 28
描述
We are using Plotly in our react application and are currently experiencing issues while unit testing components that import the Plotly library either directly, or further down the component tree.
Currently we are using the latest versions of jsdom and mocha to run our unit tests.
It appears the issue is in the Plotly node module, because our unit test suite breaks due to undefined functions in node_modules/plotly.js/dist/plotly.js
For example we get:
ReferenceError: getComputedStyle is not defined
We have attempted to stub that function (as mentioned in the closed issue #1675), but more undefined functions arise and it becomes a bit of a rabbit hole trying to stub all of the missing functions.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從使用 jsdom 和 Mocha 測試的元件中匯入 Plotly 來重現失敗,然後檢查 node_modules/plotly.js/dist/plotly.js 中第一個未定義瀏覽器函式附近的程式碼。追蹤其他缺少的函式,並判定預期且與測試相容的行為;當 Plotly 匯入時不再出現目前這一連串的瀏覽器函式錯誤,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript
- 領域
- data-visualization, testing-qa
- Issue 類型
- 缺陷
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100