问题
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