4

I am using Mocha for my test runner, and nyc for the test reporter. I don't see any uncovered lines and was wondering if anyone knows how can be uncovered functions and statements, while every line is covered. Ideas?

--------------------|----------|----------|----------|----------|----------------|
File                |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
--------------------|----------|----------|----------|----------|----------------|
  file.js           |    98.77 |      100 |    88.89 |      100 |                |
betontalpfa
  • 3,454
  • 1
  • 33
  • 65
Bryan Lemon
  • 61
  • 1
  • 5

1 Answers1

2

Leonardo Venoso pointed me in the right direction on this.

Running

nyc --reporter=html --reporter=text npm test

gave me a file located in ./coverage that highlighted the exact code that wasn't covered.

It was a line similar to

let data = arr.sort((a,b) => a.compareTo(b));

(a,b) => a.compareTo(b) was never called because arr had a length of 1.

betontalpfa
  • 3,454
  • 1
  • 33
  • 65
Bryan Lemon
  • 61
  • 1
  • 5