CodeVetter · Repo Unpack · Testing signals
tauri-apps/tauri
Testing is layered: inline Rust unit tests behind `#[cfg(test)]` in core modules, a mock runtime (`tauri::test`, `test` feature) enabling headless App tests, insta snapshot tests for ACL resolution in crates/tests/acl, a real-binary CLI integration test, WebdriverIO e2e specs in packages/api-e2e that run against examples/api via tauri-driver, vitest tests for the JS CLI package, and bench apps for CI benchmarking. Coverage is strongest around ACL/config parsing and IPC request parsing; the wry runtime and bundler are largely exercised only through e2e and examples.
- Unit tests live inline: crates/tauri/src/ipc/protocol.rs has a `parse_invoke_request` test building a real `AppManager<Wry>` via `generate_context!("test/fixture/src-tauri/tauri.conf.json")`; authority.rs has ~10 `resolve_access`/`resolve_access_message` tests; asset.rs tests multi-range responses.
- The `test` cargo feature enables `tauri::test` with `mock_app() -> App<MockRuntime>` and `mock_context`, so command/event code can be tested without a webview.
- crates/tests/acl is a dedicated integration crate: `resolve_acl` iterates fixtures/capabilities/*, builds plugin manifests from fixtures/plugins via `tauri_utils::acl::build::define_permissions`, resolves with `Resolved::resolve`, and asserts insta debug snapshots (per-target snapshots for platform-specific permissions).
- crates/tests/restart is a workspace integration binary exercising the app restart path.
- crates/tauri-cli/tests/init.rs is a real-process test: it locates the built `cargo-tauri` binary next to the test executable, runs `init --app-name testapp --frontend-dist ../dist --dev-url http://localhost:3000` in a tempdir, and asserts src-tauri/tauri.conf.json was created.
- packages/api-e2e runs WebdriverIO + mocha specs (app, core, dpi, event, image, menu, path, tray, webview, webviewWindow, window) against the examples/api app, with wdio.android.conf.ts/wdio.ios.conf.ts variants using appium.
- The JS CLI package has vitest tests under packages/cli/__tests__ (template.spec.ts); the core TS API package has no colocated unit tests — its coverage comes from api-e2e. (inferred)
- CI coverage: test-core.yml runs `cargo test` on windows-latest, ubuntu-latest and macos-14 with toolchain 1.90; separate workflows cover CLI (test-cli-rs.yml, test-cli-js.yml), e2e (test-api-e2e.yml, test-api-e2e-mobile.yml, test-android.yml), lint (lint-rust.yml, lint-js.yml), fmt, udeps, audit and supply-chain.
- Benchmarks live in bench/ with three fixture apps (helloworld, cpu_intensive, files_transfer) built in CI via bench.yml.
- Gap: crates/tauri-runtime-wry (the actual OS window/webview glue) and crates/tauri-bundler have little visible unit-test surface in-repo; correctness leans on api-e2e, examples and manual QA. (inferred)
- check-generated-files.yml enforces that generated artifacts (e.g. CLI templates/schema) are regenerated and committed, a common CI failure source when editing templates or config schema.