Skip to content

Flux’s quality bar is mechanical: every public function has a test, and the suite spans five layers. This guide shows how to run each layer and what it proves.

The project’s test runner is cargo-nextest — never plain cargo test:

Terminal
cargo nextest run
Layer Tool What it proves
Unit cargo nextest run Every function, edge cases, error paths
Property proptest Node-ID stability, diff minimality, round-trips
Snapshot insta Swift & Kotlin codegen output
Benchmark criterion Per-stage latency budgets
Parity tests/ Dev VM execution equals release codegen

Doctests run separately, because nextest does not execute them:

Terminal
cargo test --doc

The parity harness (flux-parity) is the tool that keeps the two execution tiers honest: it captures traces from dev-VM execution and from release codegen, reduces them, and checks equivalence. Golden scenarios — including a 1,000-node counter tree and no-op dispatches — live under tests/ and run in the parity-check CI workflow.

When you change lowering, differ, or codegen behavior, run the parity scenarios before trusting your own tests:

Terminal
cargo nextest run -p flux-parity

The shipping Swift (FluxBytecodeVM) and Kotlin VMs are validated against 92 golden ISA vectors under tests/isa-vectors/. The Rust VM oracle (flux-vm-ref) is the behavioral reference for the instruction set, and the vectors are shared by all three implementations, so a fault code change fails everywhere at once.

The headline metric is the Save → pixels budget — the wall-clock a developer feels during hot reload — measured end to end by the LANE-H harness: a real DevServer plus a headless loopback WebSocket client, with at least 50 edits per tree size, reported as p50/p99.

Stage Budget
Parse a 500-line file < 5 ms
Diff a 50-node tree < 1 ms
Serialize a 50-node patch < 1 ms
VM eval per frame < 2 ms

Criterion benchmarks carry these budgets; the benchmarks.yml and perf-harness.yml CI workflows run them:

Terminal
cargo bench