Enable unit test code coverage reporting #215
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Brandon, I was bitten by #197 and noticed that the accepted fix in #200 did not include a test that could have caught the problem.
I tried to generate the unit test code coverage report for this module with
grunt coverage
but received a"html-cov" reporter not found
error.It appears mocha dropped support for
html-cov
reporting in v3.0.0.Given this module does not appear to require any of the features of Mocha v3, the quickest way to generate a coverage report was to downgrade Mocha to the most recent v2.x version.
With the small change in this PR it is now possible to use
npm run coverage
(oryarn coverage
) to generate full code coverage reports.Whilst "downgrading" Mocha may feel like a step backwards, the ability to generate a code coverage report provides a big step forwards in terms of confidence-building in this useful module.
If there's interest, I could take a look at modernising the test tooling to use something like
nyc
, which provides more useful statistics around branch coverage.Cheers,
Lovell