Skip to main content
Voltaire enforces a zero-stub policy: every committed test must pass, and every bug fix starts with a regression test. Tests span Zig inline tests, Vitest unit and type-level tests, WASM/native parity tests, and language-binding suites.

Test Commands

Test File Organization

  • Zig: Inline test "..." blocks colocated inside .zig implementation files under packages/voltaire-zig/src/. Memory leaks are caught automatically via std.testing.allocator.
  • TypeScript: Colocated *.test.ts runtime tests and *.test-d.ts compile-time type tests under packages/voltaire-ts/src/.
  • WASM / Native: Dedicated *.wasm.test.ts and native test suites asserting byte-for-byte equality with pure JS implementations.

Zig Test Patterns

Use std.testing.allocator in every test that allocates so leaks fail the test immediately:

TypeScript Test Patterns

Use table-driven it.each tests for deterministic spec vectors and explicit error assertions:

Benchmarks

Voltaire tracks performance with zbench in Zig and mitata in TypeScript:

Anti-Patterns Rejected in Review

  • Commented-out or .skipped tests without an explicit tracked issue.
  • Empty test bodies or tautological assertions (expect(true).toBe(true)).
  • Catching and swallowing errors inside tests instead of expect(() => ...).toThrow(...) or testing.expectError(...).
  • Build System — All zig build and pnpm scripts
  • WASM — Running WASM parity tests
  • Architecture — Cross-language verification invariants