Skip to content

check

The check command runs tests with coverage instrumentation, evaluates coverage per domain, and enforces policy thresholds.

Terminal window
coverctl check [flags]

Alias: coverctl c

FlagDescriptionDefault
-c, --configConfig file path.coverctl.yaml
-p, --profileCoverage profile output path.cover/coverage.out
--from-profileUse existing coverage profile instead of running testsfalse
-d, --domainFilter to specific domain (repeatable)all domains
-o, --outputOutput format: text, json, htmltext
FlagDescription
--fail-under NFail if overall coverage is below N percent
--ratchetFail if coverage decreases from previous recorded value
--validateValidate config file without running tests
--show-deltaShow coverage change from previous run
--historyHistory file path for delta display
FlagDescription
--tagsBuild tags (e.g., integration,e2e)
--raceEnable race detector
--shortSkip long-running tests
-vVerbose test output
--runRun only tests matching pattern
--timeoutTest timeout (e.g., 10m, 1h)
--test-argAdditional go test argument (repeatable)
FlagDescriptionDefault
--incrementalOnly test packages with changed filesfalse
--incremental-refGit ref to compare againstHEAD~1

Incremental mode speeds up CI by only testing packages that have changed.

Terminal window
# Run coverage check with default config
coverctl check
# Use custom config file
coverctl check -c my-config.yaml
# Check specific domains
coverctl check -d core -d api
Terminal window
# Fail if coverage below 80%
coverctl check --fail-under 80
# Prevent coverage regression
coverctl check --ratchet
# JSON output for parsing
coverctl check -o json --ci
Terminal window
# Run with integration build tag
coverctl check --tags integration
# Extended timeout for slow tests
coverctl check --tags integration --timeout 30m
# With race detector
coverctl check --race --timeout 20m
Terminal window
# Only test changed packages (faster CI)
coverctl check --incremental
# Compare against specific branch
coverctl check --incremental --incremental-ref origin/main
# Combine with other flags
coverctl check --incremental --fail-under 80 --ci
Terminal window
# Check config syntax without running tests
coverctl check --validate
Terminal window
# Evaluate an existing profile without running tests
coverctl check --from-profile --profile coverage.out

Note: --from-profile only skips running tests; policy evaluation still runs against every configured domain. If you re-use a profile that already falls below a domain’s min, the check will keep failing. To unblock, regenerate a fresh profile with coverctl run / coverctl check, lower the domain thresholds or remove/adjust the matching rules, or scope the evaluation via --domain so that the enforced domains actually meet your coverage targets.

Domain Coverage Required Status
─────────────────────────────────────
core 87.3% 85% PASS
api 81.2% 80% PASS
cli 76.4% 75% PASS
─────────────────────────────────────
Overall 82.1% 75% PASS
{
"passed": true,
"domains": [
{
"name": "core",
"covered": 1234,
"total": 1414,
"percent": 87.3,
"required": 85,
"status": "pass"
}
]
}

If coverctl check disagrees with previously recorded history, make sure the history profile was produced by coverctl run or coverctl check. Profiles generated with plain go test -coverprofile can omit -coverpkg instrumentation, which makes history and policy checks diverge.

CodeMeaning
0All policy checks passed
1Policy violation (coverage below threshold)
2Invalid configuration or arguments
3Test execution failed
  • run - Run coverage without policy enforcement
  • report - Analyze existing coverage profile
  • Configuration - Configure coverage policies