Skip to content
Unverified: This page has not yet been anchored to automated code tests.

vox-cli-tests API Reference (generated)

Crate: vox-cli-tests · Version: 0.6.0 · Target: Library (lib.rs)

End-to-end CLI integration tests for vox build and friends — runs the CLI as a subprocess via assert_cmd, then asserts emitted TS compiles via tsc --noEmit and emitted Rust compiles via cargo check.

Shared helpers for the CLI integration test harness (Phase 0.3 of mobile-rn-expo-implementation-spec-2026.md §1).

The harness runs cargo run -p vox-cli -- build <fixture>.vox -o <tempdir> as a subprocess and asserts the emitted output is real, not stubbed. Each fixture sits in tests/fixtures/<name>/ with a main.vox source and an expected_files.toml listing filenames that MUST appear in the output directory.

The harness checks five things per fixture:

  1. Exit code 0. The CLI must succeed.
  2. No panicked at in stderr. Catches the §0.1 class of bugs (library-works, CLI-panics) that snapshot tests miss.
  3. Expected files exist in the output directory.
  4. TypeScript compiles — every emitted *.tsx/*.ts passes npx tsc --noEmit against a shared tests/tsconfig.json.
  5. Rust compiles (when the build target produces target/generated/Cargo.toml) — cargo check --manifest-path target/generated/Cargo.toml succeeds.

Tsc + cargo-check require network/disk access; they are gated behind environment variables (VOX_CLI_TESTS_SKIP_TSC=1, VOX_CLI_TESTS_SKIP_CARGO=1) so CI can opt out per-step when the toolchain isn’t available.

DependencyKind
vox-cliDevelopment
vox-codegenDevelopment
vox-compilerDevelopment
StructDescription
ExpectedFilesShape of expected_files.toml next to each fixture’s main.vox.
BuildRunOne end-to-end run of vox build against a fixture.
FunctionDescription
workspace_rootLocate the workspace root by walking up until we find a Cargo.toml with [workspace].
fixture_dirPath to a fixture directory inside this crate’s tests/fixtures/.
vox_binary_pathPath to the vox binary cargo built before our tests started running. vox-cli is declared as a [dev-dependencies] entry in our Cargo.toml — cargo builds it during test setup, depositing the binary at <workspace>/target/debug/vox{ .exe }. We compute that path here rather than running cargo build from inside the test (which would race the outer cargo test’s target-directory file lock).
runRun vox build against a fixture and capture the result.
assert_success(1) Exit code 0.
assert_no_panic(2) No panicked at in stderr. Regression gate for §0.1-class bugs.
assert_expected_files(3) Expected files present, forbidden files absent.
assert_tsc_compiles(4) Every emitted *.tsx/*.ts compiles under tsc --noEmit. Skipped when VOX_CLI_TESTS_SKIP_TSC=1 is set. Honors tsc if on PATH; otherwise falls back to npx tsc (assumes Node + npm + write permission on a temporary npx cache). When neither is available, prints a warning and returns without asserting.
assert_cargo_check(5) Generated Rust backend compiles under cargo check. Skipped when VOX_CLI_TESTS_SKIP_CARGO=1 is set or when the fixture’s emits_rust_backend = false.
assert_allRun all five assertions in order. Convenience for the standard fixture flow.