Conversation
Contributor
|
f1e6af2 was deployed to: https://fred-pr1908.review.mdn.allizom.net/ |
Add a `--coverage` option to the `unit` test command that wraps `node --test` with `c8`, and use it in CI. `all: true` reports files without any coverage. Type declarations, generated output, the legacy bundle, vendored code, scripts, and tests themselves are excluded.
caugner
force-pushed
the
setup-c8-coverage
branch
from
September 14, 2026 15:00
ab1e104 to
3873b53
Compare
caugner
marked this pull request as ready for review
September 14, 2026 15:08
| "dist/**", | ||
| "legacy/**", | ||
| "out/**", | ||
| "scripts/**", |
Contributor
There was a problem hiding this comment.
With "all": true, every non-excluded .js file is reported, so build-time tooling that unit tests never load is counted as 0% and dilutes the metric. scripts/** and test/** are excluded, but two equivalent categories are not:
build/**— 15 build-time files (build/loaders/*.js,build/plugins/*.js,build/eslint-fred.js,build/hmr.js, …), the same kind of tooling asscripts/**.wdio.conf.js— e2e runner config; it does not match*.config.js, so it slips through whiletest/**is excluded.
Add both:
Suggested change
| "scripts/**", | |
| "scripts/**", | |
| "build/**", | |
| "wdio.conf.js", |
AI-generated review by Claude
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
Sets up test coverage with c8, adds a
--coverageoption tonpm test -- unit, and uses it in CI.Motivation
Make it easier to identify missing test coverage.
Additional details
Unlike mdn/dex#263, coverage is enabled via
npm test -- unit --coveragerather than a separatetest:coveragescript, because fred routes all test commands throughscripts/tests.js.The
.c8rc.jsonexcludestypes/,legacy/,vendor/,scripts/,test/, build output and config files, and limits reporting to.jsfiles. The generatedcoverage/directory is ignored in git, Prettier, andtsconfig.json; ESLint and stylelint already pick up.gitignore.Related issues and pull requests
Same as mdn/dex#263 and mdn/private-locale-translator#279.