vox-cli-tests API Reference (generated)
vox-cli-tests
Section titled “vox-cli-tests”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.
Crate Overview
Section titled “Crate Overview”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:
- Exit code 0. The CLI must succeed.
- No
panicked atin stderr. Catches the §0.1 class of bugs (library-works, CLI-panics) that snapshot tests miss. - Expected files exist in the output directory.
- TypeScript compiles — every emitted
*.tsx/*.tspassesnpx tsc --noEmitagainst a sharedtests/tsconfig.json. - Rust compiles (when the build target produces
target/generated/Cargo.toml) —cargo check --manifest-path target/generated/Cargo.tomlsucceeds.
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.
Workspace Dependencies
Section titled “Workspace Dependencies”| Dependency | Kind |
|---|---|
vox-cli | Development |
vox-codegen | Development |
vox-compiler | Development |
Public API Surface
Section titled “Public API Surface”Structs
Section titled “Structs”| Struct | Description |
|---|---|
ExpectedFiles | Shape of expected_files.toml next to each fixture’s main.vox. |
BuildRun | One end-to-end run of vox build against a fixture. |
Functions
Section titled “Functions”| Function | Description |
|---|---|
workspace_root | Locate the workspace root by walking up until we find a Cargo.toml with [workspace]. |
fixture_dir | Path to a fixture directory inside this crate’s tests/fixtures/. |
vox_binary_path | Path 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). |
run | Run 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_all | Run all five assertions in order. Convenience for the standard fixture flow. |