rustydocs

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 whole rusty test verb (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

FormKindBehavior
"**/*.test.rs"globCo-located file tests
"tests/**/*.rs"globIntegration-style tree
"tests/http.rs"fileSingle path (skipped if missing)
"unit" or { "kind": "unit" }unitrustc --test on lib and/or bin roots
"doctest" or { "kind": "doctest" }doctestrustdoc --test on lib root only
{ "path": "…" } / { "glob": "…" }file/globObject 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

VariableRole
RUSTY_JOBSShared parallel job budget (overrides -j / CARGO_BUILD_JOBS)
CARGO_BUILD_JOBSFallback job budget
RUSTY_TEST_CACHE0 / false / off disables test binary cache
RUSTY_HOMECAS / artifact store root for cache payloads

See Environment for the full list.

On this page