Guides
Watch Mode
Overview
Watch mode monitors your source files and automatically re-runs affected tests when files change. This provides a fast feedback loop during development.
axm watchHow It Works
The watcher uses the on glob in each test to determine which file changes trigger which tests. When a file changes, only the tests whose on pattern matches that file are re-run. Tests for unrelated files are not affected.
For example, if you have a test with on: ["src/api/**/*.ts"] and you edit a file in src/components/, that test will not re-run.
Options
| Flag | Description |
|---|---|
-d, --dir <path> | Project directory (default: .) |
--debounce <ms> | Wait time after last file change before re-running (default: 300) |
Usage Examples
# Watch all tests
axm watch
# Increase debounce for slower file systems
axm watch --debounce 500Tips
- Watch mode works best with well-scoped
onpatterns. Narrow globs mean fewer unnecessary re-runs. - Watch mode respects the cache -- if a file changes back to its previous state, the cached result is used.