Cache
Karva caches test durations for scheduling and failed test names for
--last-failed.
The cache lives in .karva_cache under the project root. Coverage runs also write per-worker coverage artifacts there.
Re-running just the failures
--last-failed (or --lf) restricts the run to whichever tests failed in the previous invocation:
| Bash | |
|---|---|
1 | |
After fixing failures, run the full suite again:
| Bash | |
|---|---|
1 2 3 | |
Combine with --watch to keep iterating until they all pass:
| Bash | |
|---|---|
1 | |
If the last run had no failures, --last-failed runs nothing.
Disabling the cache
--no-cache disables reading and writing reusable test history for the current run. Tests are scheduled without duration hints and --last-failed becomes a no-op. Coverage artifacts are still written when coverage is enabled.
| Bash | |
|---|---|
1 | |
Managing the cache
Two uv run karva cache subcommands manage cache contents directly:
| Bash | |
|---|---|
1 2 | |
prune preserves test history. Use clean to reset it.