lundi 11 juillet 2016

Karma test coverage always high inspite of testing only one file

I am doing unit testing for React using karma, webpack, babel, mocha and PhantomJS. I referred to this link: http://ift.tt/29Lttcp

I have a statement like in my karma.conf.js

postLoaders:{http://test:/\.jsx?$,loader:babel-istanbul-loader',include:[__dirname + 'src'], query: {presets:['es2015', 'react']}}

I have a couple of components, but only one unit test. Everytime I run the test, the test coverage comes to be 90% (which is the coverage of that specific component which I am testing).

Do I make the karma coverage a preLoader to instrument all the source files? Right now I expect the total coverage to be something like 10% (since there's only one component being tested and 4 others are not).

What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire