Skip to content

Testing

Manech Dubreil edited this page Sep 1, 2026 · 1 revision

Testing

Running tests

cargo test                # run the full suite
cargo test -- --nocapture # with stdout
cargo test <test_name>    # a single test

CI quality gates

Every pull request against main or dev runs (see .github/workflows/):

  • cargo fmt --all -- --check (quality.yml)
  • cargo clippy --all-targets --all-features -- -D warnings (quality.yml)
  • cargo test --all (tests.yml)
  • cargo tarpaulin --all --out Xml for coverage, uploaded to Codecov (tests.yml)
  • cargo audit for dependency vulnerabilities (security.yml)

Conventions

Tests are colocated with the code they exercise (#[cfg(test)] mod tests at the bottom of each module), not in a separate tests/ directory. Concrete examples:

  • src/pivot/mod.rs — schema_round_trips_through_json asserts Schema::from_json(schema.to_canonical_json()) == schema; canonical_json_has_sorted_keys asserts the serialization property described in Pivot IR.
  • src/importer/prisma/mod.rs — one focused unit test per feature, plus parse_full_test_schema, a comprehensive test that parses test.prisma (a realistic multi-table fixture at the repo root) and asserts a full JSON round-trip.

See Importers for how this pattern should extend to a new importer or exporter.

Clone this wiki locally