reactjs - Exports defaults else path not taken with Jest and ES6 -


i'm having issues pass tests 100% coverage. istanbul exports defaults component else path not taken.

because of that, see in generated html of istanbul tests not @ 100%. in statements , branches tab.

i'm using:

  • react: 15.4.0
  • jest: 17.0.2
  • webpack: 1.12.11

any idea?

enter image description here enter image description here

the problem in jest configuration, using preprocessor in order resolve imports:

in package json had this:

"transform": {   "^.+\\.js$": "<rootdir>/cfg/preprocessor.js" }, 

this file contained this:

const babeljest = require('babel-jest'); require('babel-register'); const webpackalias = require('jest-webpack-alias');  module.exports = {   process: function (src, filename) {     if (filename.indexof('node_modules') === -1) {       src = babeljest.process(src, filename);       src = webpackalias.process(src, filename);     }     return src;   } }; 

we updated jest v20 , use module resolver jest, in our package.json added:

"moduledirectories": [   "node_modules",   "src" ], 

and removed transform config package.json , preprocessor.js file.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -