istanbuljs / babel-plugin-istanbul

A babel plugin that adds istanbul instrumentation to ES6 code
BSD 3-Clause "New" or "Revised" License
616 stars 72 forks source link

How to generate full coverage data in out.json for all source files? #293

Open WallaceChen123 opened 2 months ago

WallaceChen123 commented 2 months ago

I am using babel-plugin-istanbul to generate code coverage report, however, I found that the out.json file only includes the coverage data for tested source files as below: "C:\path\to\file\a.ts": { "path": "C:\path\to\file\a.ts", "statementMap": { "0": { "start": { "line": 4, "column": 2 }, "end": { "line": 4, "column": 116 } }, ......skip other data...... }

the coverage data for un-tested source files is missing as below: "C:/path/to/file/b.ts": { "path": "C:/path/to/file/b.ts", "statementMap": {}, "fnMap": {}, "branchMap": {}, "s": {}, "f": {}, "b": {} }, Based on the out.json file, the generated coverage report only displays coverage for the tested source files and ignores un-tested source files, so the total coverage is incorrect.

May I know is there any method to generate all coverage data in out.json for all source files including tested and un-tested source files? Thanks in advance.