TypeError:无法读取属性' length'在React Enzyme Testing中未定义

时间:2017-02-21 12:58:24

标签: reactjs mocha enzyme

我正在测试一些反应组件,一个基本的测试套件,只是为了知道组件是否正在渲染以及他们的孩子。

1) Test suite Stepper Stepper:
  **TypeError: Cannot read property 'length' of undefined**
   at Stepper.render (D:/SAPADS/build/operation/common/stepper/Stepper.jsx:7:18)
   at D:\SAPADS\build\node_modules\react-dom\lib\ReactCompositeComponent.js:796:21
   at measureLifeCyclePerf (D:\SAPADS\build\node_modules\react-dom\lib\ReactCompositeComponent.js:75:12)
   at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (D:\SAPADS\build\node_modules\react-dom\lib\ReactCompositeComponent.js:795:25)
   at ReactCompositeComponentWrapper._renderValidatedComponent (D:\SAPADS\build\node_modules\react-dom\lib\ReactCompositeComponent.js:822:32)
   at ReactCompositeComponentWrapper.performInitialMount (D:\SAPADS\build\node_modules\react-dom\lib\ReactCompositeComponent.js:362:30)
   at ReactCompositeComponentWrapper.mountComponent (D:\SAPADS\build\node_modules\react-dom\lib\ReactCompositeComponent.js:258:21)
   at Object.mountComponent (D:\SAPADS\build\node_modules\react-dom\lib\ReactReconciler.js:46:35)
   at ReactCompositeComponentWrapper.performInitialMount (D:\SAPADS\build\node_modules\react-dom\lib\ReactCompositeComponent.js:371:34)

使用Enzyme + Mocha.Pls运行测试用例时出错会帮助我解决这个问题。

0 个答案:

没有答案