istanbul: 1.0.0-alpha.2 : File [/foo/bar.js] ignored, nothing could be mapped

Created on 14 Mar 2016  路  7Comments  路  Source: gotwarlost/istanbul

Running istanbul 1.0.0-alpha.2 on babel generated code with [source-maps] option set to (https://babeljs.io/docs/usage/cli/) both (babel 6.6.5, babel-core 6.7.2) I got many warnings like that:

File [/Users/Yves/foo/bar.js] ignored, nothing could be mapped

Here is how I run istanbul:

istanbul cover _mocha -- ./test --compilers js:babel-register \
   --require babel-polyfill \
   --require should \
   --require sinon

Most helpful comment

Just ran into this as well. I believe it has to do with named vs anonymous default exports.

I put together a super simple example repo that reproduces this here.

  • named — gets covered
  • anonymous — throws File ... ignored warning and is not covered

My current workaround is to just structure my code with named exports.

All 7 comments

Just ran into this as well. I believe it has to do with named vs anonymous default exports.

I put together a super simple example repo that reproduces this here.

  • named — gets covered
  • anonymous — throws File ... ignored warning and is not covered

My current workaround is to just structure my code with named exports.

I'm getting this error in files whose only contents are named export statements, but of the following form:

/* eslint-disable */

// @create-index

export handle from './handle.js';
export throwEx from './throwEx.js';

(created via create-index).

On second thoughts, it kind of makes sense in my case as there's probably nothing to "cover" here.

any resolution to this? I don't want to create a massive commit changing every index.js export in my project...

I'm switching to jest: https://github.com/facebook/jest

@yvele after x hours (too embarrassed to say exactly how long) of trying to set up mocha and nyc to run the simplest possible unit test and generate a coverage report with ES6 import and export default, I tried going with your suggestion, and within 10 minutes, everything just freaking worked.

@bengrunfeld Yep it's way more easy.. jest replaces mocha, chai, istanbul, nyc, rewire.... and is way more powerful 馃槈

any update here?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

attodorov picture attodorov  路  33Comments

jonathanong picture jonathanong  路  18Comments

dcrockwell picture dcrockwell  路  37Comments

jasonpincin picture jasonpincin  路  22Comments

blindenvy picture blindenvy  路  19Comments