Skip to content

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.
Dependency Topology, diagram 14 nodes, 3 edges: vox-cli-tests → vox-cli; vox-cli-tests → vox-codegen; vox-cli-tests → vox-compilervox-cli-testsvox-clivox-codegenvox-compiler
Diagram source
graph {
direction: right
node vox_cli_tests: "vox-cli-tests"
node vox_cli: "vox-cli"
vox_cli_tests -> vox_cli
node vox_codegen: "vox-codegen"
vox_cli_tests -> vox_codegen
node vox_compiler: "vox-compiler"
vox_cli_tests -> vox_compiler
}
KindSymbolSignatureSourceDescription
structExpectedFilespub struct ExpectedFilescrates/vox-cli-tests/src/lib.rs#L31-L51Shape of expected_files.toml next to each fixture’s main.vox.
structBuildRunpub struct BuildRuncrates/vox-cli-tests/src/lib.rs#L54-L61One end-to-end run of vox build against a fixture.
fnworkspace_rootpub fn workspace_root() -> PathBufcrates/vox-cli-tests/src/lib.rs#L65-L82Locate the workspace root by walking up until we find a Cargo.toml with [workspace].
fnfixture_dirpub fn fixture_dir(name: &str) -> PathBufcrates/vox-cli-tests/src/lib.rs#L85-L90Path to a fixture directory inside this crate’s tests/fixtures/.
fnvox_binary_pathpub fn vox_binary_path() -> &'static Pathcrates/vox-cli-tests/src/lib.rs#L99-L115Path 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).
fnrunpub fn run(name: &str) -> Selfcrates/vox-cli-tests/src/lib.rs#L118-L171Run vox build against a fixture and capture the result.
fnassert_successpub fn assert_success(&self)crates/vox-cli-tests/src/lib.rs#L174-L180(1) Exit code 0.
fnassert_no_panicpub fn assert_no_panic(&self)crates/vox-cli-tests/src/lib.rs#L183-L190(2) No panicked at in stderr. Regression gate for §0.1-class bugs.
fnassert_expected_filespub fn assert_expected_files(&self)crates/vox-cli-tests/src/lib.rs#L193-L213(3) Expected files present, forbidden files absent.
fnassert_tsc_compilespub fn assert_tsc_compiles(&self)crates/vox-cli-tests/src/lib.rs#L221(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.
fnassert_cargo_checkpub fn assert_cargo_check(&self)crates/vox-cli-tests/src/lib.rs#L364-L397(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.
fnassert_allpub fn assert_all(&self)crates/vox-cli-tests/src/lib.rs#L400-L406Run all five assertions in order. Convenience for the standard fixture flow.