sinonjs / fake-timers

Fake setTimeout and friends (collectively known as "timers"). Useful in your JavaScript tests. Extracted from Sinon.JS
BSD 3-Clause "New" or "Revised" License
802 stars 105 forks source link

Test coverage: use nyc #274

Closed mroderick closed 4 years ago

mroderick commented 4 years ago

This PR adds tasks for calculating coverage (test-coverage) and to check coverage (test-check-coverage).

This paves the way for putting this project in line with the other Sinon projects and get us to 100% test coverage.

How to verify

  1. Check out this branch
  2. npm ci
  3. npm run test-coverage
  4. Observe a nice coverage report
  5. Modify the tolerances for coverage in package.json, set a value higher than the measured coverage
  6. npm run test-check-coverage
  7. Observe that there is an error displayed
  8. Observe that there was a non-zero exit code (echo $?)
  9. git reset --hard
  10. npm run test-check-coverage
  11. Observe that there is no error displayed
  12. Observe that a zero exit code (echo $?)