C8 mistakenly reports lack of coverage for empty lines - sometimes.
This only seems to happen to files with export * from ...
pattern
with a newline preceeding EOF - at least that is the observed pattern.
I am not very familiar with the inner workings of c8.
Before we get into it, the source is organized to be accessed in two ways:
src/
index.ts - an exporter of main.ts (the problem file)
main.ts - the simple business end of the code
git clone https://github.com/sramam/c8-empty-lines
npm install
NODE_V8_COVERAGW=./.c8-data
rm -rf .c8-data .c8-report
npm run build
npm run test-main
npm run report
npm run report
> [email protected] report C:\Users\srama\tmp\c8-empty-lines
> c8 report -r lcov -r text --report-dir ./.c8-report
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 100 | 100 | 100 | 100 |
src | 100 | 100 | 100 | 100 |
main.ts | 100 | 100 | 100 | 100 |
src/test | 100 | 100 | 100 | 100 |
main.ts | 100 | 100 | 100 | 100 |
----------|---------|----------|---------|---------|-------------------
rm -rf .c8-data .c8-report
npm run build
npm run test-index
npm run report
npm run report
> [email protected] report C:\Users\srama\tmp\c8-empty-lines
> c8 report -r lcov -r text --report-dir ./.c8-report
-----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-----------|---------|----------|---------|---------|-------------------
All files | 100 | 80 | 100 | 100 |
src | 100 | 75 | 100 | 100 |
index.ts | 100 | 66.67 | 100 | 100 | 1
main.ts | 100 | 100 | 100 | 100 |
src/test | 100 | 100 | 100 | 100 |
index.ts | 100 | 100 | 100 | 100 |
-----------|---------|----------|---------|---------|-------------------