The smart searchlight for your test suite. Fast, graph-powered selection for Jest and Cargo.
npm install headlampHeadlamp is a Rust-powered test UX CLI: smarter test selection, cleaner output, and a unified workflow across jest, Rust tests (headlamp runner), cargo test, cargo nextest, and pytest.
Headlamp is useful when you want a consistent way to run tests across different projects and keep feedback fast as your repo grows. It can select tests based on what changed, surface failures in a readable format, and keep common defaults (like runner args and coverage settings) in a single config file so your team doesn’t have to remember a long list of flags.
- One CLI, many runners: --runner=headlamp|jest|cargo-nextest|cargo-test|pytest
- Selection that scales: run what changed (--changed) and what’s related (dependency-graph driven)
- Coverage-first UX: coverage output you can actually read
- Fast: Rust core + caching
Requirements:
- Node >= 18
Install:
``bash`
npm i -D headlamp
Run:
`bash`
npx headlamp --help
Install from crates.io:
`bash`
cargo install headlamp
Install:
`bash`
pip install headlamp
`bash`
headlamp --runner=pytest
Headlamp is a wrapper around your project’s runners. It does not vendor the runners themselves, so you need the runner executables available in your environment for the features you’re using.
- Git: required for --changed=... modes (e.g. --changed=branch).
- Node.js: required.
- Jest installed in the repo: Headlamp expects Jest to be runnable from your project (typically ./node_modules/.bin/jest).--coverage
- Coverage (): requires Jest coverage support (standard Jest --coverage + reporters). Headlamp formats/prints coverage from generated reports.
- Python 3: required.
- pytest: must be on PATH (pytest / pytest.exe).--coverage
- Coverage (): requires pytest-cov (Headlamp enables coverage and passes --cov flags; branch coverage uses --cov-branch).
- Rust toolchain: cargo + rustc.--report-time
- Per-test timings: requires a preinstalled nightly toolchain (Headlamp enables libtest JSON + only when nightly is available).rustup toolchain install nightly
- Install via:
- Rust toolchain: cargo + rustc.--coverage
- Coverage (): collected via LLVM tools from rustup (no cargo-llvm-cov dependency).rustup component add llvm-tools-preview
- Install via:
- Rust toolchain: cargo + rustc.cargo-nextest
- nextest: requires (cargo install cargo-nextest).--coverage
- Coverage (): collected via LLVM tools from rustup (no cargo-llvm-cov dependency).rustup component add llvm-tools-preview
- Install via:
`bash`
npx headlamp --runner=jest
Forward runner args after -- (unknown args are forwarded):
`bash`
npx headlamp --runner=jest -- --runInBand
`bash`
headlamp --runner=cargo-nextest
headlamp --runner=cargo-test
Requirements:
- --runner=cargo-nextest: requires cargo-nextest to be installed.cargo install cargo-nextest
- Install via: (or your preferred installer)
Run headlamp --help to see the up-to-date flags list.
Highlights:
- runners: --runner=headlamp|jest|pytest|cargo-nextest|cargo-test--changed=all|staged|unstaged|branch|lastCommit|lastRelease
- changed selection: lastRelease
- selects changes since the previous stable SemVer release tag--coverage
- coverage: plus --coverage-ui, --coverage-detail, thresholds, etc.--keep-artifacts
- artifacts (default: none): to keep runner artifacts on disk
Legacy aliases (still accepted, but not recommended):
- --keepArtifacts--coverage.detail
-
Headlamp discovers config from your repo root. Supported file names:
- headlamp.toml (highest precedence)headlamp.config.ts
- headlamp.config.js
- headlamp.config.mjs
- headlamp.config.cjs
- headlamp.config.json
- headlamp.config.json5
- headlamp.config.jsonc
- headlamp.config.yaml
- headlamp.config.yml
- .headlamprc
- plus .headlamprc.* variants (.json, .json5, .jsonc, .yaml, .yml, .js, .cjs, .mjs, .ts)
Headlamp also supports embedded TOML config (lower precedence than explicit config files):
- pyproject.toml under [tool.headlamp]Cargo.toml
- under [package.metadata.headlamp]
`tomlRun tests sequentially (useful for very heavy integration tests)
sequential = true
[coverage]
abort_on_failure = true
mode = "auto"
page_fit = true
keep_artifacts = false
[changed]
depth = 20
`
Rules:
- Must have a default export
- Only relative imports are supported inside the config file (./ and ../)
`ts
export default {
// Runner defaults
jestArgs: ["--runInBand"],
// Run once before tests (npm script name or a shell command)
bootstrapCommand: "test:jest:bootstrap",
// Global toggles
ci: false,
verbose: false,
noCache: false,
keepArtifacts: false,
// Coverage defaults
coverage: true,
coverageUi: "both",
coverage: {
abortOnFailure: true,
mode: "auto",
pageFit: true,
},
// Changed selection defaults
changed: { depth: 2 },
};
`
By default, headlamp runs artifact-free: it uses an ephemeral per-run workspace and does not leave files behind in your repo (e.g. coverage/, .coverage, .pytest_cache, target/) or OS temp.
If you need artifacts on disk (for example, to upload coverage reports in CI), opt out:
- CLI: --keep-artifactskeepArtifacts: true
- Config:
Pull requests are welcome. For large changes, open an issue first to align on direction.
- Bug reports and feature requests: GitHub Issues
MIT — see LICENSE`.