Skip to content
Latchkey

deno coverage: Report Test Coverage

deno coverage reads the profile written by deno test --coverage and produces a human or machine report.

Coverage is a two-step flow in Deno: tests write raw data, then deno coverage summarizes it or exports LCOV for a coverage service.

What it does

deno coverage consumes the directory created by deno test --coverage and reports line and branch coverage. It can print a table, emit LCOV for upload, or generate an HTML report, with include/exclude filters to scope the result.

Common usage

Terminal
deno test --coverage=cov_profile
deno coverage cov_profile
# export LCOV for a coverage service
deno coverage cov_profile --lcov --output=cov.lcov
# scope to your source only
deno coverage cov_profile --include='src/'

Options

FlagWhat it does
<dir>Coverage profile directory from deno test --coverage
--lcovOutput LCOV format
--output=<file>Write the report to a file
--htmlGenerate an HTML coverage report
--include=<regex>Only include matching files
--exclude=<regex>Exclude matching files (defaults exclude test files)

In CI

Run deno test --coverage=cov_profile, then deno coverage cov_profile --lcov --output=cov.lcov and upload the LCOV. Restore DENO_DIR before the test step so the run is fast. Cache the profile directory only within the job, not across jobs.

Common errors in CI

"No covered files included in the report" means the profile is empty or your --include filter matched nothing; check that deno test actually ran with --coverage. "No such file or directory" means the profile path is wrong. An LCOV upload that shows 0% usually means the report scoped out all your source files.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →