Configuration
Configure discovery with the rusty.json "test" array — file, unit, and doctest.
Lifecycle vs discovery
- Top-level
"test"array — what units the native runner discovers (this page). scripts.test— optional shell override for the wholerusty testverb (e.g."cargo test"). When set, the native runner is not used. Prefer native defaults unless you need cargo for a pure interop use case.
Defaults
When "test" is absent from rusty.json:
["**/*.test.rs", "tests/**/*.rs"]Cargo-format packages get the same file defaults (no [[test]] table yet). Unit and doctest are opt-in so default behavior stays file-test only.
When "test" is present and empty, no units are planned (explicit opt-out).
Full example
{
"name": "demo",
"version": "0.1.0",
"edition": "2021",
"test": [
"unit",
"doctest",
"**/*.test.rs",
"tests/**/*.rs"
]
}Directive kinds
| Form | Kind | Behavior |
|---|---|---|
"**/*.test.rs" | glob | Co-located file tests |
"tests/**/*.rs" | glob | Integration-style tree |
"tests/http.rs" | file | Single path (skipped if missing) |
"unit" or { "kind": "unit" } | unit | rustc --test on lib and/or bin roots |
"doctest" or { "kind": "doctest" } | doctest | rustdoc --test on lib root only |
{ "path": "…" } / { "glob": "…" } | file/glob | Object form (extra keys ignored today) |
Unit tests
{ "test": ["unit", "**/*.test.rs"] }"unit" compiles crate roots with rustc --test (lib and/or bin), same idea as cargo unit-test units — never via cargo test. Planned names: unit:lib:demo / unit:bin:demo.
Doctests
{ "test": ["unit", "doctest"] }"doctest" runs library documentation tests with rustdoc --test (deps/externs from the native build graph). Planned name: doctest:lib:demo. Bin-only packages contribute no doctest unit.
--no-run skips doctests (rustdoc always executes when invoked).
Environment
| Variable | Role |
|---|---|
RUSTY_JOBS | Shared parallel job budget (overrides -j / CARGO_BUILD_JOBS) |
CARGO_BUILD_JOBS | Fallback job budget |
RUSTY_TEST_CACHE | 0 / false / off disables test binary cache |
RUSTY_HOME | CAS / artifact store root for cache payloads |
See Environment for the full list.