salesforce / kagekiri

Shadow DOM-piercing query APIs for the browser.
BSD 3-Clause "New" or "Revised" License
86 stars 9 forks source link

test: adding code coverage #37

Closed tedconn closed 4 years ago

tedconn commented 4 years ago

Fixes #27

Coverage is generated into /coverage (ignored) and currently looks like this:

----------|---------|----------|---------|---------|--------------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s        
----------|---------|----------|---------|---------|--------------------------
All files |     100 |     91.3 |     100 |     100 |                          
 index.js |     100 |     91.3 |     100 |     100 | 15,43,78,126,156,234-242 
----------|---------|----------|---------|---------|--------------------------

I don't understand how the line coverage can be 100% but the branch 91.3%. I removed some tests to see how the report changes and it was exactly what you would expect, so I am confident this is accurate.

In addition, I added a threshold check which will cause the test runner to fail if the threshold is not met.

nolanlawson commented 4 years ago

@tedconn See https://github.com/tedconn/kagekiri/pull/1 , you can use this to add an HTML reporter, which is useful for debugging. When I open it up, I can see some branches that aren't coverage (but maybe should be – or else ignored).

nolanlawson commented 4 years ago

This is awesome! Thanks @tedconn