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.
coverctl watch [flags]Alias: coverctl w
Configuration
Section titled “Configuration”| Flag | Description | Default |
|---|---|---|
-c, --config | Config file path | .coverctl.yaml |
-p, --profile | Coverage profile output path | .cover/coverage.out |
-d, --domain | Filter to specific domain (repeatable) | all domains |
Build/Test Flags
Section titled “Build/Test Flags”| Flag | Description |
|---|---|
--tags | Build tags (e.g., integration,e2e) |
--race | Enable race detector |
--short | Skip long-running tests |
-v | Verbose test output |
--run | Run only tests matching pattern |
--timeout | Test timeout (e.g., 10m, 1h) |
--test-arg | Additional go test argument (repeatable) |
Examples
Section titled “Examples”Basic Usage
Section titled “Basic Usage”# Start watching all domainscoverctl watch
# Watch specific domaincoverctl watch -d coreDevelopment Workflow
Section titled “Development Workflow”# Watch with verbose outputcoverctl watch -v
# Watch with short tests only (faster feedback)coverctl watch --shortIntegration Testing
Section titled “Integration Testing”# Watch integration testscoverctl watch --tags integration
# Watch with extended timeoutcoverctl watch --tags integration --timeout 5mBehavior
Section titled “Behavior”- Initial Run: Runs coverage check immediately on start
- File Watching: Monitors
.gofiles in the project - Debouncing: Waits briefly after changes to batch rapid edits
- Re-run: Runs coverage check after changes are detected
- Clear: Clears terminal before each run for clean output
Watched Files
Section titled “Watched Files”The watcher monitors:
- All
.gofiles in the project - The configuration file (
.coverctl.yaml)
Changes to these files trigger a re-run.
Output
Section titled “Output”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.goRunning coverage check...─────────────────────────────────────Filter to Specific Domain
Section titled “Filter to Specific Domain”For faster feedback during development, watch only the domain you’re working on:
coverctl watch -d coreUse Short Flag
Section titled “Use Short Flag”Skip slow tests for rapid iteration:
coverctl watch --shortCombine with Verbose
Section titled “Combine with Verbose”See detailed test output:
coverctl watch -v -d corePress Ctrl+C to stop watching.