Test Commands Reference
Quick reference for running tests from the project root.
๐ฆ Sweettest (Rust) โ Primary
Runs Holochain in-process. Faster, no WebSocket round-trip, direct Rust types.
Four [[test]] binaries (targets for cargo test --test <name>):
miscโ ping test, validates full build chain end-to-endpersonโ Person zome + hREA bridge testsresourceโ Resource zome testsnondominiumโ NDO Layer 0 (NondominiumIdentity) lifecycle tests (8 scenarios)
# Build .dna bundle then run all Rust tests
bun run sweettest
# Same with --nocapture (see test output in real time)
bun run sweettest:verbose
# Skip build:happ if .dna is already built
bun run sweettest:only
Cargo commands directly (inside nix develop):
# Requires LIBCLANG_PATH and BINDGEN_EXTRA_CLANG_ARGS to be set (exported by nix develop)
CARGO_TARGET_DIR=target/native-tests cargo test -p nondominium_sweettest
CARGO_TARGET_DIR=target/native-tests cargo test -p nondominium_sweettest -- --nocapture
# Run a specific test module
CARGO_TARGET_DIR=target/native-tests cargo test --package nondominium_sweettest --test misc
CARGO_TARGET_DIR=target/native-tests cargo test --package nondominium_sweettest --test person
CARGO_TARGET_DIR=target/native-tests cargo test --package nondominium_sweettest --test resource
CARGO_TARGET_DIR=target/native-tests cargo test --package nondominium_sweettest --test governance
Lobby DNA Sweettest
# Prerequisites: build:happ must have been run first
bun run build:happ
# Run all Lobby Sweettest tests
CARGO_TARGET_DIR=target/native-tests cargo test --package lobby_sweettest --test lobby
# With test output visible
CARGO_TARGET_DIR=target/native-tests cargo test --package lobby_sweettest --test lobby -- --nocapture
# Run a single test
CARGO_TARGET_DIR=target/native-tests cargo test --package lobby_sweettest --test lobby announce_ndo_cross_conductor
NDO Layer 0 tests (--test nondominium)
# Run all NDO Layer 0 tests
CARGO_TARGET_DIR=target/native-tests cargo test --test nondominium
# Run a single scenario
CARGO_TARGET_DIR=target/native-tests cargo test --test nondominium ndo_cross_agent_discovery
๐ Tryorama (TypeScript) โ Deprecated
Still the primary test suite until NDO refactor lands and Sweettest tests are co-evolved.
๐ Basic Test Commands
All commands automatically build zomes and package the hApp before running tests.
# Run all tests
bun tests
# Run tests with verbose output
bun tests --reporter=verbose
# Run tests in watch mode for development
bun tests --watch
# Generate coverage reports
bun tests --coverage
๐ฏ Pattern-Based Test Selection
The test system uses file name pattern matching to run specific test subsets:
# Run all person-related tests
bun tests person
# Run all resource-related tests
bun tests resource
# Run all governance-related tests
bun tests governance
# Run all PPR system tests
bun tests ppr
๐ Layer-Specific Test Patterns
# Run all foundation tests (basic connectivity)
bun tests foundation
# Run all integration tests (multi-agent interactions)
bun tests integration
# Run all scenario tests (complete user workflows)
bun tests scenario
๐ง Specific Test Files
# Run specific test files using partial name matching
bun tests person-foundation
bun tests person-integration
bun tests person-scenario
bun tests resource-foundation
bun tests resource-integration
bun tests resource-scenario
bun tests ppr-foundation
bun tests ppr-integration
bun tests ppr-scenarios
bun tests ppr-cryptography
bun tests ppr-debug
bun tests person-capability
bun tests governance-foundation
๐ฏ Development Workflow Commands
# Development with hot reload
bun tests --watch person
# Debug specific test with verbose output
bun tests --reporter=verbose ppr-foundation
# Run tests for a specific feature area
bun tests resource
bun tests governance
bun tests person
๐งน Test Quality & Type Checking
# Run tests with type checking
bun tests --typecheck
# Run type checking only (from tests directory)
cd tests && npm run check
# Run tests with coverage analysis
bun tests --coverage
๐ก Test Development Tips
Test Isolation During Development
Use .only() on specific test blocks to run single tests:
describe.only('specific test suite', () => { ... }) // Run only this suite
it.only('specific test', async () => { ... }) // Run only this test
test.only('specific test', async () => { ... }) // Run only this test
Rust Zome Debugging
Use the warn! macro in Rust zome functions to log debugging info:
#![allow(unused)] fn main() { warn!("Debug info: variable = {:?}", some_variable); warn!("Checkpoint reached in function_name"); warn!("Processing entry: {}", entry_hash); }
๐ Test File Structure
tests/src/nondominium/
โโโ person/ # bun tests person
โ โโโ person-foundation-tests.test.ts
โ โโโ person-integration-tests.test.ts
โ โโโ person-scenario-tests.test.ts
โ โโโ person-capability-based-sharing.test.ts
โโโ resource/ # bun tests resource
โ โโโ resource-foundation-tests.test.ts
โ โโโ resource-integration-tests.test.ts
โ โโโ resource-scenario-tests.test.ts
โ โโโ resource-update-test.test.ts
โโโ governance/ # bun tests governance
โ โโโ governance-foundation-tests.test.ts
โ โโโ ppr-system/ # bun tests ppr
โ โโโ ppr-foundation.test.ts
โ โโโ ppr-integration.test.ts
โ โโโ ppr-scenarios.test.ts
โ โโโ ppr-cryptography.test.ts
โ โโโ ppr-debug.test.ts
โโโ misc/ # bun tests misc
โโโ misc.test.ts
๐ฏ Recommended Testing Workflow
- Feature Development:
bun tests --watch <feature-area> - Specific Test Debugging:
bun tests --reporter=verbose <specific-test> - Pre-commit Validation:
bun tests foundation && bun tests --typecheck - Full Validation:
bun tests && bun tests --coverage
๐ Pattern Matching Rules
The bun tests command uses Vitest's file filtering:
- Prefix Matching:
bun tests personmatches all files starting with "person-" - Partial Matching:
bun tests foundationmatches all files containing "foundation" - Specific Files: Use unique parts of filenames for precise selection
- Multiple Patterns: Chain multiple patterns for broader coverage
โก Performance Tips
- Use Specific Patterns:
bun tests person-foundationis faster thanbun tests person - Foundation First: Run foundation tests before integration/scenario tests
- Parallel Execution: Tests run in parallel by default for maximum speed
- Verbose Output: Use
--reporter=verbosefor debugging but not for routine runs
All commands run from the project root and automatically handle the complete build โ test cycle! ๐
Environment: Requires Nix development environment (nix develop) for Holochain binaries.