Test code coverage javascript es6 generators (redux-saga / istanbul.js)

痞子三分冷 提交于 2021-01-27 14:33:05

问题


Working with redux-saga, I wrote some tests.
I tried to generate code coverage using istanbul.js.
It works fine for most of the code but the result for the sagas is broken: seems like random information.
Anyone knows how to solve this ?


回答1:


I personally use Jest, which includes code coverage and it seems to work fine with my sagas.

I also wrote a test utility to help testing sagas (redux-saga-testing), and in the repo, you'll find examples of tests written with Jest, Mocha and AVA. Both Jest and Mocha (with Istanbul) have code coverage enabled, so you should see there an example of using the holy Mocha/Istanbul/redux-saga trinity in real life.



来源:https://stackoverflow.com/questions/40274054/test-code-coverage-javascript-es6-generators-redux-saga-istanbul-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!