test: set up test coverage with c8 - #563
Open
caugner wants to merge 1 commit into
Open
Conversation
Add a `test:coverage` script that wraps the existing test command with `c8`, and run it in CI so missing coverage is easy to spot. `all: true` surfaces source files with no coverage at all. Ignore the generated `coverage/` directory in git and Prettier; ESLint already ignores it via `.gitignore`.
caugner
force-pushed
the
setup-c8-coverage
branch
from
July 15, 2026 21:52
079f7ef to
600260a
Compare
caugner
marked this pull request as ready for review
July 15, 2026 21:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Set up test coverage with
c8:test:coveragescript that wraps the existingnpm testcommand withc8.test:coveragein the CI test job so missing coverage is easy to spot.c8via.c8rc.jsonwithall: true(so source files with no coverage at all are still reported) and excludes foreslint.config.js,coverage/,node_modules/, andtest/.coverage/directory in git and Prettier. ESLint already ignores it via.gitignore(includeIgnoreFile).Motivation
Make it easy to identify missing test coverage.
Additional details
c8uses its defaulttextreporter, printing a coverage summary at the end of the test run.Unlike mdn/dex#263, the test exclude is
test/**rather than**/*.test.js, because this repo keeps test helpers (test/helpers.js,test/helpers/db.js) alongside the*.test.jsfiles.Related issues and pull requests
Similar to mdn/dex#263.