【问题标题】:Jest - ReferenceError: SVGPathElement is not definedJest - ReferenceError: SVGPathElement 未定义
【发布时间】:2022-11-17 13:33:28
【问题描述】:

我正在尝试运行 Jest 单元测试来匹配快照,但 am4core 似乎存在问题。 有谁知道如何解决它?

测试: Test

错误: Error

谢谢

【问题讨论】:

    标签: reactjs jestjs amcharts4


    【解决方案1】:

    节点上不存在 SVGPathElement。它存在于浏览器中。因此添加此测试

    class SVGPathElement extends HTMLElement {}
    window.SVGPathElement = SVGPathElement
    
    describe('your test', () => {
    

    【讨论】:

      猜你喜欢
      • 2022-12-31
      • 2020-01-09
      • 2021-05-19
      • 2021-05-09
      • 2021-12-24
      • 2019-12-16
      • 2021-06-12
      • 2012-08-24
      • 1970-01-01
      相关资源
      最近更新 更多