Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ jobs:
- name: 'Install the dependencies'
run: 'pnpm install'

- name: Checking code format ciphernode
run: pnpm ciphernode:lint
- name: Checking code format rust
run: pnpm rust:lint

- name: Run Unit Tests
run: 'cargo test --lib && cargo test --doc'
Expand Down Expand Up @@ -131,8 +131,8 @@ jobs:
- name: 'Install the dependencies'
run: 'pnpm install'

- name: Checking code format ciphernode
run: pnpm ciphernode:lint
- name: Checking code format rust
run: pnpm rust:lint

- name: Run Integration Tests
run: 'cargo test --test integration -- --nocapture && cargo test --test integration_legacy -- --nocapture'
Expand Down
50 changes: 47 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,57 @@ pnpm i
# Build the project
pnpm build

# Run tests
pnpm test

# Clean build artifacts
pnpm clean
```

### Testing

**⚠️ Important:** Always run tests through pnpm scripts, not directly via `cargo test` or other build tools. The pnpm scripts ensure necessary setup steps are executed (e.g., building required binaries, setting up test environments) that may be skipped when running tests directly.

#### Test Scripts

The monorepo provides several test scripts for different components:

- **`pnpm test`** - Runs all tests across the entire monorepo:

- EVM/Smart contract tests (`evm:test`)
- Rust crate tests (`rust:test`)
- SDK tests (`sdk:test`)
- Noir circuit tests (`noir:test`)

- **`pnpm rust:test`** - Runs all Rust crate tests in the `crates/` directory. This script runs tests for all crates in the workspace, not just ciphernode-related crates.

- **`pnpm evm:test`** - Runs tests for the EVM smart contracts in `packages/enclave-contracts`.

- **`pnpm sdk:test`** - Runs tests for the TypeScript SDK in `packages/enclave-sdk`.

- **`pnpm noir:test`** - Runs tests for Noir circuits in the `circuits/` directory using `nargo test`.

- **`pnpm test:integration`** - Runs integration tests from `tests/integration/`. These tests may require prebuilt binaries and can be run with `--no-prebuild` if binaries are already available.

#### Running Individual Test Suites

```bash
# Run only Rust crate tests
pnpm rust:test

# Run only EVM/smart contract tests
pnpm evm:test

# Run only SDK tests
pnpm sdk:test

# Run only Noir circuit tests
pnpm noir:test

# Run only integration tests
pnpm test:integration

# Run integration tests without prebuild step (if binaries already exist)
pnpm test:integration --no-prebuild
```

### Contributors

<!-- readme: contributors -start -->
Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,26 @@
"scripts": {
"bump:versions": "tsx scripts/bump-versions.ts",
"clean": "tsx scripts/clean.ts",
"compile": "pnpm evm:build && pnpm sdk:build && pnpm react:build && pnpm ciphernode:build",
"lint": "pnpm evm:lint && pnpm ciphernode:lint && ./scripts/lint-circuits.sh",
"compile": "pnpm build:ts && pnpm rust:build",
"lint": "pnpm evm:lint && pnpm rust:lint && pnpm noir:lint",
"format": "prettier --write \"**/*.{js,json,md,mdx,ts,tsx,yml,yaml,css}\"",
"format:check": "prettier --check \"**/*.{js,json,md,mdx,ts,tsx,yml,yaml,css}\"",
"check:license": "./scripts/check-license-headers.sh",
"check:size": "./scripts/check-size.sh",
"check:pnpm": "./scripts/check-pnpm.sh",
"test": "pnpm evm:test && pnpm ciphernode:test && pnpm sdk:test && ./scripts/test-circuits.sh",
"test": "pnpm evm:test && pnpm rust:test && pnpm sdk:test && pnpm noir:test",
"test:integration": "cd ./tests/integration && ./test.sh",
"coverage": "pnpm evm:coverage",
"prepare": "husky",
"enclave": "cd crates && ./scripts/launch.sh",
"ciphernode:lint": "cargo fmt -- --check",
"rust:lint": "cargo fmt -- --check",
"ciphernode:add": "cd packages/enclave-contracts && pnpm ciphernode:admin-add",
"ciphernode:remove": "cd packages/enclave-contracts && pnpm ciphernode:remove",
"ciphernode:test": "cd crates && ./scripts/test.sh",
"ciphernode:build": "cargo build --locked --release",
"preciphernode:build": "pnpm evm:build",
"rust:test": "cd crates && ./scripts/test.sh",
"noir:test": "./scripts/test-circuits.sh",
"noir:lint": "./scripts/lint-circuits.sh",
"rust:build": "cargo build --locked --release",
"prerust:build": "pnpm evm:build",
"committee:new": "cd packages/enclave-contracts && pnpm committee:new",
"committee:publish": "cd packages/enclave-contracts && pnpm hardhat committee:publish",
"e3:activate": "cd packages/enclave-contracts && pnpm e3:activate",
Expand All @@ -53,8 +55,7 @@
"npm:release": "pnpm build && pnpm config:release && pnpm evm:release && pnpm wasm:release && pnpm sdk:release && pnpm react:release",
"support:build": "cd crates/support && ./scripts/build.sh",
"build": "pnpm compile",
"wasm:build": "cd ./crates/wasm && pnpm build",
"release": "pnpm build && changeset publish",
"wasm:build": "cd crates/wasm && pnpm build",
"build:ts": "pnpm evm:build && pnpm sdk:build && pnpm react:build"
},
"packageManager": "pnpm@10.7.1+sha512.2d92c86b7928dc8284f53494fb4201f983da65f0fb4f0d40baafa5cf628fa31dae3e5968f12466f17df7e97310e30f343a648baea1b9b350685dafafffdf5808",
Expand Down
2 changes: 1 addition & 1 deletion packages/enclave-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"access": "public"
},
"scripts": {
"prebuild": "cd ../enclave-contracts && pnpm build && cd ../../crates/wasm && pnpm build",
"prebuild": "pnpm -C ../enclave-contracts build && pnpm -C ../../ wasm:build",
"build": "tsup",
"dev": "tsup --watch",
"clean": "rm -rf dist",
Expand Down
Loading