How to ignore _interopRequireDefault function in istanbul reach report?

Babel compiles my modules to include the following line:

function _interopRequireDefault(obj) { 
    return obj && obj.__esModule ? obj : { default: obj }; 
}

Which, in my best understanding, should deal with importing CommonJS .

How can I ignore this line because it is included in my coverage report? My coverage area usually depends on this line.

I was unable to add an inline ignore comment, for example /* istanbul ignore next */, because I cannot add it directly to this line. Adding a comment to the beginning of the file adds it before the class definition.

I also tried using the Babel secondaryCommentBefore option to add a comment before the compiled lines, but it adds it almost everywhere in the code, so it can be used.

Is there a way to ignore this line when analyzing coverage?

+4
source share
1 answer

In the end, we used isparta so that the coverage used ES6 code before forwarding, which is actually more accurate (we wanted to check the coverage of the code we actually wrote, and not the code that was compiled). Thanks for the help.:)

0
source

All Articles