Rust · native + browser WebAssembly

Keep the test source Rust.

Use the zero-dependency native crate with Cargo, then compile the exact same Rust unit tests into a safe browser WebAssembly harness. No JavaScript test copy, wasm framework, generated glue, or unsafe block is required; the optional benchmark uses one scoped linkage-only export attribute.

Native

Cargo owns the native path.

cargo add vanilla-test
cargo test

Native Cargo provides full libtest output, doctests, typed lifecycle errors, formatting checks, and package verification.

Browser

One command emits the browser test.

rustup target add wasm32-unknown-unknown
cargo install vanilla-test --version 2.1.0
cargo vanilla-test --browser

The dependency-free Cargo subcommand emits a deployable example with passive rendered-text, fetch, MIME, instantiation, and export checks. It then calls the same Rust library harness once and treats zero as passed. Every result appears on-page and in DevTools. Add --page tests/browser.html to inspect already-rendered text from a compatible page beside that harness.

Contract

A small native state machine.

One active test, exact unique descriptions, first decision wins, undecided completion fails, and reporting seals the suite. Rust uses ordinary results and its type system instead of copying JavaScript-only runtime behavior.

Start

Rust guide

Install, run native tests, build browser WebAssembly, add passive rendered-text checks, and deploy the output.

Open the Rust guide →
Copy

Rust examples

Complete native suites, typed-error handling, browser commands, and a passive-text page.

Open Rust examples →
API

Rust API reference

Public types, methods, result fields, lifecycle errors, and a complete program.

Open the Rust API →
Coverage

LLVM source coverage

Review native region, executable-line, and function evidence without conflating browser compatibility.

Open Rust coverage →
Reference

Generated crate docs

Browse the public types and method documentation for the published crate.

Open docs.rs →
Evidence

Native and browser gates

CI tests the native library and browser-build CLI, then runs the same library suite as WebAssembly in Chrome.

Review Rust testing →
Browser scope is explicit.

The exact minimal target is wasm32-unknown-unknown. This repository's module has zero host imports, so Rust cannot call JavaScript functions, the DOM, the console, or other browser APIs. The tiny host adapter performs passive page and delivery checks, then runs the same seven Rust #[test] functions—including the Behavioral consumer journey—through aggregate libtest status. Native Cargo prints individual Rust names and diagnostics; a WASM panic traps the browser run, and OS- or thread-dependent tests remain native-only.