prototype using c8 as a test coverage lib; try alternatives to tape-runner #2858
+2,112
−79
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.
Description
Work-in-progress. Puppeteer seems like an excellent replacement for tape-run, and has built-in code coverage API the can generate nyc/istanbul-compatible output.
To test:
npm run test:unit
, should see test coverage report like in the screenshot belownpm run test:puppet
, must have selenium-webdriver installed globally or in parent repo (likesjpp
). The terminal logs should be the same as in a desktop browser console, when running the same testsTODOs:
generate test coverage report in browser environments (both desktop and headless)Notes:
nyc
/istanbul
instrumentation lib does not seem to support esmimport
syntax, only cjsrequire()
, so any imported code/spec files are not instrumented for coverage, as being reached during test executionc8 check-coverage --lines 95 --functions 95 --branches 95
may use Chrome Profiler from https://v8.dev/blog/javascript-code-coverage (not sure about this yet)EDIT: use puppeteer with istanbulScreenshot of server unit test coverage, also logged in github unit test actions for this PR

Screenshot of client unit test coverage using puppeteer

Checklist
Check each task that has been performed or verified to be not applicable.