Giter VIP home page Giter VIP logo

c8-empty-lines's Introduction

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.

This simple POC of the issue, provides two demonstrations.

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

Installation

git clone https://github.com/sramam/c8-empty-lines
npm install
NODE_V8_COVERAGW=./.c8-data

The successful case - 100% coverage

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 |
----------|---------|----------|---------|---------|-------------------

The trouble case

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 |
-----------|---------|----------|---------|---------|-------------------

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.