Repository navigation
Testing
iomi edited this page Nov 25, 2026
·
9 revisions
cargo test
cargo test signals::
cargo test --test cli fresh_package
cargo clippy --all-targets -- -D warnings
cargo fmt --checkThe suite is roughly 900 tests: unit tests in each module and an end-to-end suite that runs the real binary against a local fake registry.
tests/cli.rs starts TcpListeners and points the binary at them through
DEPVET_REGISTRY_BASE, DEPVET_OSV_BASE, DEPVET_EPSS_BASE,
DEPVET_KEV_BASE, DEPVET_SCORECARD_BASE, DEPVET_MAVEN_REPO_BASE, and the
other DEPVET_*_BASE seams. The cache is disabled except in tests that verify
it.
Rules:
- No test reaches the public internet or the real
~/.cache/dep-vet. - Scripted servers return status sequences, so retries and
Retry-Afterare deterministic. - Failed requests cost a few hundred milliseconds because of bounded backoff; do not remove the sleeps.
- Archives are built in the test process and served from the same fake host.
git config core.hooksPath .githooks-
pre-commitvets staged lockfiles againstHEADand audits a newly added lockfile. Exit 2/3 blocks; warnings pass. -
pre-pushruns fmt, clippy, the full suite, then the workflow and MCP self-scans.
.github/workflows/ci.yml runs:
-
teston Ubuntu, macOS, and Windows. - Formatting, clippy, and cargo-audit on Linux only.
-
dogfood: auditCargo.lock, scan hand-written workflows, scan MCP configs; the generatedrelease.ymlgoes to the step summary. - The weekly npm seed refresh and release workflows have their own checks.
- Prefer a unit test next to the rule or parser.
- If the change is user-visible through the CLI, add an end-to-end case with a fake server.
- For a bug, write the failing test first and keep it as the regression case.
- Every new finding id needs a
KNOWN_FINDINGSentry and a confidence mapping; the allowlist completeness test enforces the first.