Open-Source Wikis

/

Tauri

/

How to contribute

/

Testing

tauri-apps/tauri

Testing

Tauri's test suite is split across the Rust and JS halves of the workspace. There is no single "run all tests" command — you run the suite for the language and crate you touched.

Rust tests

Rust unit tests live next to the code they test (#[cfg(test)] mod tests). Larger, multi-crate integration tests live under crates/tests/:

Path What it covers
crates/tests/acl/ End-to-end ACL resolution: capabilities + permissions + scope checks.
crates/tests/app-updater/ Updater bundle generation and signature verification flow.
crates/tests/restart/ The process::restart helper.
crates/tauri/test/ Fixture Tauri projects exercised by the core crate's integration tests.
crates/tauri-cli/tests/ CLI command-line behaviour tests.

Run a focused test:

cargo test -p tauri --all-features
cargo test -p tauri-utils
cargo test -p tauri-bundler -- bundle::settings
cargo test --workspace --all-targets         # everything (slow)

The core crate uses proptest and quickcheck for fuzz-style testing of HTTP-range parsing and a few path utilities — see [dev-dependencies] in crates/tauri/Cargo.toml.

Test feature

crates/tauri/Cargo.toml exposes a test feature that enables the mod test module (crates/tauri/src/test/) with helpers for spinning up a mock app inside a unit test. Plugin and command authors use this to write integration tests without an actual webview.

JavaScript tests

Each npm package owns its own test runner. pnpm test at the root runs pnpm run -r test, which invokes test in every workspace package. The API package uses vitest; the CLI package mostly relies on the underlying Rust tests.

pnpm test                                     # all packages
pnpm --filter @tauri-apps/api test            # only the JS API

Type-checking is a separate command:

pnpm ts:check

Lint and format checks

The same tools run in CI as locally:

cargo fmt --all -- --check                    # rustfmt; CI: fmt.yml
cargo clippy --workspace --all-targets -- -D warnings   # CI: lint-rust.yml
pnpm eslint:check                             # CI: lint-js.yml
pnpm format:check                             # Prettier; CI: fmt.yml

pnpm format:check is enforced over Rust and non-Rust files (Prettier touches Markdown, YAML, TS, JSON). The .prettierignore at the repo root excludes target/, dist/, lockfiles, etc.

Generated-file checks

crates/tauri-schema-generator produces JSON Schema files (config.schema.json, ACL schemas). The CI workflow check-generated-files.yml runs cargo run -p tauri-schema-generator and fails if it produces a diff. Run it locally before pushing if you've changed config or ACL types:

cargo run -p tauri-schema-generator

Supply-chain checks

  • audit.yml runs cargo audit on the lockfile.
  • supply-chain.yml runs cargo vet against the audits in audits/. Adding a new dependency requires either an existing trust chain or a new audit entry.
  • udeps.yml runs cargo udeps and is somewhat eventual — it's nightly-only and tolerated to flake.

Mobile-specific tests

test-android.yml builds an Android target through the CLI to make sure the mobile bridge still compiles. There is no equivalent automated iOS test in CI; iOS is exercised manually against examples/api.

Benchmarks

bench/ holds a bench.rs and three minimal Tauri projects (cpu_intensive, files_transfer, helloworld) used by bench.yml to track binary size and startup deltas across PRs. They are not run on every push — only nightly.

Where to add a new test

Change type Add the test here
Pure Rust unit Inline #[cfg(test)] mod tests next to the code.
Cross-crate behaviour crates/tests/<feature>/
tauri-cli subcommand crates/tauri-cli/tests/ and a fixture project under crates/tauri-cli/tests/
Config schema or ACL type crates/tauri-utils/src/acl/ (unit) and crates/tests/acl/ (integration)
@tauri-apps/api module A *.test.ts next to the source under packages/api/src/

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Testing – Tauri wiki | Factory