Skip to content

watch

The watch command monitors your project for file changes and automatically re-runs coverage checks. Ideal for development workflows where you want continuous feedback.

Terminal window
coverctl watch [flags]

Alias: coverctl w

FlagDescriptionDefault
-c, --configConfig file path.coverctl.yaml
-p, --profileCoverage profile output path.cover/coverage.out
-d, --domainFilter to specific domain (repeatable)all domains
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)
Terminal window
# Start watching all domains
coverctl watch
# Watch specific domain
coverctl watch -d core
Terminal window
# Watch with verbose output
coverctl watch -v
# Watch with short tests only (faster feedback)
coverctl watch --short
Terminal window
# Watch integration tests
coverctl watch --tags integration
# Watch with extended timeout
coverctl watch --tags integration --timeout 5m
  1. Initial Run: Runs coverage check immediately on start
  2. File Watching: Monitors .go files in the project
  3. Debouncing: Waits briefly after changes to batch rapid edits
  4. Re-run: Runs coverage check after changes are detected
  5. Clear: Clears terminal before each run for clean output

The watcher monitors:

  • All .go files in the project
  • The configuration file (.coverctl.yaml)

Changes to these files trigger a re-run.

Watching for changes... (Ctrl+C to stop)
─────────────────────────────────────
Running coverage check...
─────────────────────────────────────
Domain Coverage Required Status
─────────────────────────────────────
core 87.3% 85% PASS
─────────────────────────────────────
Watching for changes...
─────────────────────────────────────
File changed: internal/core/service.go
Running coverage check...
─────────────────────────────────────

For faster feedback during development, watch only the domain you’re working on:

Terminal window
coverctl watch -d core

Skip slow tests for rapid iteration:

Terminal window
coverctl watch --short

See detailed test output:

Terminal window
coverctl watch -v -d core

Press Ctrl+C to stop watching.

  • check - Single coverage check
  • run - Generate coverage profile only