-
Notifications
You must be signed in to change notification settings - Fork 788
Highlighting Incorrect in Babel ES2015 Code #557
Comments
@skozin as a temporary solution... I changed the css so that .no-branch has a left border of 10px solid red... instead of a background color... This way you only see highlighting at the start of the missed coverage. hacky but works. |
@cphoover, thanks, interesting hack. I'll try it =) BTW, I've found that, in my case, the issue is probably related not to istanbul itself, but to nyc, which is a coverage tool built on istanbul that works for apps with subprocesses. See this issue: istanbuljs/nyc#198. |
@julmot, +1, but probably the only way to do this is to use info from sourcemaps to see whether the specific part of generated code maps to some location in the sources, and exclude it from report if not (i.e. don't highlight it and don't count in covered/total functions/branches/statements/lines numbers). Probably this can be done only on function level, as Babel only generates helpers in form of functions. On the other hand, Babel uses regenerator to transpile generators and async/await functions, and regenerator produces statements that cannot be mapped to the original source. But I would be happy even if Istanbul covered only the non-generator case. See also: #582, istanbuljs/nyc#198 (comment). |
* Add npm script `cover`, which calls istanbul: * Do not execute `istanbul` via `babel-node`, this is deprecated, instead use `babel-register` as an argument to `mocha` (credit: gotwarlost/istanbul#594 (comment)) * Use `--root src/` to fix issue where istanbul also attempts to cover `mocha` (credit: douglasduteil/isparta#68 (comment)) * Use `--include-all-sources` to make the coverage percentages actually meaningful by including sources that didn't get executed * In `src/higher_order_components/errors_normalizer.js`, make minor change to return statement. This form: `if (foo) return { a: 'b' }` seems to have confused Istanbul's coverage highlighter. There are other cases like this, that are bugs in Istanbul (e.g. gotwarlost/istanbul#557). Probably worth making a repro case for this and reporting to them.
* Add npm script `cover`, which calls istanbul: * Do not execute `istanbul` via `babel-node`, this is deprecated, instead use `babel-register` as an argument to `mocha` (credit: gotwarlost/istanbul#594 (comment)) * Use `--root src/` to fix issue where istanbul also attempts to cover `mocha` (credit: douglasduteil/isparta#68 (comment)) * Use `--include-all-sources` to make the coverage percentages actually meaningful by including sources that didn't get executed * In `src/higher_order_components/errors_normalizer.js`, make minor change to return statement. This form: `if (foo) return { a: 'b' }` seems to have confused Istanbul's coverage highlighter. There are other cases like this, that are bugs in Istanbul (e.g. gotwarlost/istanbul#557). Probably worth making a repro case for this and reporting to them.
@cphoover Agreed. This appears to just be proble with utilizing the |
When running coverage against babel es2015 source code, highlighting is completely off.
It seems to start perhaps in the correct position, but the end of the highlighting is off.
Here is an annotated screenshot of the issue:
http://imgur.com/xXFWjtp
The text was updated successfully, but these errors were encountered: