Test Commands Reference

Canonical command reference for running tests from the project root. This is the one place that lists every suite; other docs link here rather than restating commands.

Suite status: Sweettest (Rust) is the primary suite and the only place new tests are written. Tryorama (TypeScript, tests/) is deprecated โ€” see tests/DEPRECATED.md. E2E (Playwright) covers the UI-to-conductor seam โ€” see ui/tests/README.md.

๐Ÿฆ€ Sweettest (Rust) โ€” Primary

Runs Holochain in-process. Faster, no WebSocket round-trip, direct Rust types.

Each DNA has its own Sweettest package. [[test]] binaries (targets for cargo test --test <name>):

PackageBinaries
nondominium_sweettestmisc โ€” ping test, validates full build chain end-to-end
person โ€” Person zome + hREA bridge tests
resource โ€” Resource zome tests
governance โ€” Governance zome tests (hard links, contributions, agreements)
nondominium โ€” NDO Layer 0 (NondominiumIdentity) lifecycle tests
group_sweettestgroup โ€” group lifecycle, membership, work logs, soft links
ndo_anchor โ€” NDO anchor tests
lobby_sweettestlobby โ€” agent profiles and group announcements
# 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_group_cross_conductor

Group DNA Sweettest

Tests live in dnas/group/tests/src/group/mod.rs. Covers group creation, get_group (fetch by hash), get_my_group, membership (join/leave/is_member/duplicate-join guard), work logs (log_work, get_work_logs, get_my_work_logs, delete_work_log), soft links (create_soft_link, get_soft_links, delete_soft_link), update_group, and validation rejection cases (empty name, zero hours).

Note: Each test spins up 2 Holochain conductors. Running all 13 tests concurrently requires --test-threads 6 (12 conductors max) to avoid port/resource contention.

# Prerequisites: build:happ must have been run first
bun run build:happ

# Run all Group Sweettest tests (thread-limited to avoid conductor contention)
CARGO_TARGET_DIR=target/native-tests cargo test --package group_sweettest --test group -- --test-threads 6

# With test output visible
CARGO_TARGET_DIR=target/native-tests cargo test --package group_sweettest --test group -- --test-threads 6 --nocapture

# Run a single test (no thread limit needed)
CARGO_TARGET_DIR=target/native-tests cargo test --package group_sweettest --test group join_group_creates_membership

# NDO anchor tests (second binary in the same package)
CARGO_TARGET_DIR=target/native-tests cargo test --package group_sweettest --test ndo_anchor

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

๐ŸŽญ E2E (Playwright + real conductors)

Browser-level coverage of the Lobby โ†’ Group โ†’ NDO holarchy against real conductors. Full detail, architecture, and debugging notes: ui/tests/README.md.

bun run build:happ          # once, or after zome changes โ€” e2e does NOT rebuild
bun run e2e                 # headless
bun run e2e:ui              # Playwright UI mode (debugging)

E2E_PLAYGROUND=1 bun run e2e   # also start `hc playground` for DHT inspection

๐Ÿ“‹ Tryorama (TypeScript) โ€” DEPRECATED

Do not write new tests here. Everything below documents the legacy Tryorama suite in tests/, kept as historical reference only and no longer maintained. New tests go in Sweettest (above). Migration status: tests/DEPRECATED.md.

Basic Test Commands (legacy)

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

Sweettest (Rust): mark unfinished tests #[ignore], or filter by name with cargo test <name>.

Tryorama (legacy): 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);
}

๐Ÿ“ฆ Tryorama legacy reference (deprecated)

Everything in this section describes the deprecated tests/ suite. Kept for archaeology.

๐Ÿ“Š 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
  1. Feature Development: bun tests --watch <feature-area>
  2. Specific Test Debugging: bun tests --reporter=verbose <specific-test>
  3. Pre-commit Validation: bun tests foundation && bun tests --typecheck
  4. Full Validation: bun tests && bun tests --coverage

๐Ÿ” Pattern Matching Rules

The bun tests command uses Vitest's file filtering:

  • Prefix Matching: bun tests person matches all files starting with "person-"
  • Partial Matching: bun tests foundation matches 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-foundation is faster than bun 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=verbose for 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.