docs/testing-coverage.md
CI runs Rust, Python, and TypeScript tests plus lint/type checks. Coverage is
orchestrated in justfile with direct CLI calls, using ninja only to prepare
generated build artifacts that the test commands need.
just test # run all tests (no coverage)
just test --coverage # run all tests + enforce coverage thresholds
just test --coverage --html # same + generate HTML reports under out/coverage/
just test-rust # Rust only
just test-rust --coverage
just test-rust --coverage --html
just test-py # Python (pylib + qt) only
just test-py --coverage
just test-py --coverage --html
just test-ts # TypeScript/Svelte Vitest only
just test-ts --coverage
just test-ts --coverage --html
HTML reports are written under out/coverage/ (gitignored).
| Stack | Test runner | Coverage tool | Minimum |
|---|---|---|---|
| Rust workspace | cargo nextest via cargo-llvm-cov | cargo-llvm-cov | 60% |
Python pylib/anki | pytest pylib/tests | coverage.py | 63% |
Python qt/aqt | pytest qt/tests | coverage.py | 20% |
| TypeScript/Svelte | vitest run | Vitest V8 | 5% |
Linux pull requests run just test --coverage in CI. macOS and Windows
jobs run just test (no coverage enforcement) for now.
cargo-llvm-cov is installed on demand into out/bin/ to avoid
polluting the global cargo install. Coverage runs rebuild the workspace with
instrumentation, so they are slower than plain just test-rust.
Windows ARM64 (aarch64-pc-windows-msvc) is not supported: the Rust
compiler produces malformed .profraw files on that target
(rust-lang/rust#150123,
cargo-llvm-cov#436).
just test-rust --coverage exits with a clear message on ARM64 Windows;
use just test-rust (no coverage) or rely on CI (Linux) for enforcement.pylib and qt) because
they have different PYTHONPATH setups and test folders.SonarCloud runs automatically on every push and pull request via CI. It aggregates the coverage reports generated by the three stacks and runs static analysis across Python, TypeScript, and Rust.
just test --coverageThe quality gate is configured as non-blocking — a failing gate does not prevent merging, but the results are visible on the PR.
out/coverage/ as a CI artifact so reviewers can browse HTML
reports directly from a PR.