with one click
aztec-testing
// Use this skill when testing Aztec smart contracts, including Noir tests with TestEnvironment and TypeScript integration tests with Aztec.js on local-network/devnet-like setups.
// Use this skill when testing Aztec smart contracts, including Noir tests with TestEnvironment and TypeScript integration tests with Aztec.js on local-network/devnet-like setups.
Use this skill when working with Aztec account implementations and lifecycle flows, including Schnorr/ECDSA account flavors, account abstraction entrypoints, transaction routing, key-store integration, deployment, and wallet reconstruction.
Use this skill when creating, editing, testing, debugging, or upgrading Aztec smart contracts in Noir/Aztec.nr, including storage modeling, private/public/utility functions, note delivery, authwit authorization, TestEnvironment tests, and artifact/codegen workflows.
Use this skill when deploying Aztec smart contracts (not authoring them), including local-network and devnet deployment via aztec-wallet/Aztec.js, fee-payment setup, deterministic addresses, deployment verification, and contract registration workflows.
Use this skill when building TypeScript applications with Aztec.js, including node/PXE connectivity, account lifecycle, contract deployment and interaction, transaction/fee handling, authwit authorization, event reads, and test automation.
Use this skill when implementing or debugging direct PXE workflows in TypeScript, including private execution lifecycle, note discovery/synchronization, sender/recipient tagging, private events, scopes, and oracle/debug checks.
Use this skill when integrating Aztec wallet connectivity with @aztec/wallet-sdk, including discovery/session flows, secure-channel key exchange, extension handlers, encrypted messaging, and BaseWallet implementations.
| name | aztec-testing |
| description | Use this skill when testing Aztec smart contracts, including Noir tests with TestEnvironment and TypeScript integration tests with Aztec.js on local-network/devnet-like setups. |
| license | Proprietary. LICENSE.txt has complete terms |
| compatibility | Pinned to aztec-packages v4.2.0 (commit f8c89cf4345df6c4ca9e66ea9b738e96070abc5a). |
| metadata | {"version_label":"v4.2.0","commit_sha":"f8c89cf4345df6c4ca9e66ea9b738e96070abc5a","source_map":"aztec-packages/docs/internal_notes/llm_docs_skill_candidates.md"} |
Use this skill for contract testing only:
TestEnvironmentaztec.jsOut of scope:
aztec-contracts)aztec-deployment)aztec-js)Use the upstream repository and pin:
https://github.com/AztecProtocol/aztec-packagesv4.2.0f8c89cf4345df6c4ca9e66ea9b738e96070abc5aCheckout example:
git clone https://github.com/AztecProtocol/aztec-packages.git
cd aztec-packages
git checkout v4.2.0
git status
Expected status includes HEAD detached at v4.2.0.
aztec test (not nargo test).aztec compile before aztec test after contract changes.create_contract_account() whenever authwit behavior is under test.create_light_account() for faster non-authwit tests..simulate() before .send() for safety and clearer failure assertions. Note that .simulate() returns { result, ... } — use the result field for reads and assertions.Noir tests:
scripts/preflight_aztec_testing.sh
scripts/run_noir_contract_tests.sh /path/to/contract/crate
TypeScript integration tests:
scripts/preflight_aztec_testing.sh http://localhost:8080
scripts/install_aztec_testing_deps.sh npm
scripts/run_ts_integration_tests.sh /path/to/ts-tests npm test http://localhost:8080
TestEnvironmentTestEnvironment per test.setup(...)).env.deploy(...).with_*_initializer(...) or .without_initializer().Minimal skeleton:
use crate::MyContract;
use aztec::{
protocol::address::AztecAddress,
test::helpers::test_environment::TestEnvironment,
};
pub unconstrained fn setup() -> (TestEnvironment, AztecAddress, AztecAddress) {
let mut env = TestEnvironment::new();
let owner = env.create_light_account();
let initializer = MyContract::interface().constructor(owner);
let contract = env.deploy("MyContract").with_public_initializer(owner, initializer);
(env, contract, owner)
}
#[test]
unconstrained fn happy_path() {
let (env, contract, owner) = setup();
env.call_public(owner, MyContract::at(contract).set_value(42));
assert_eq(env.view_public(MyContract::at(contract).get_value()), 42);
}
Use the right call primitive for each assertion:
env.call_private(...) for private state transitionsenv.call_public(...) for public state transitionsenv.view_private(...)/env.view_public(...) for static readsenv.execute_utility(...) for unconstrained utility readsadd_private_authwit_from_calladd_public_authwit_from_call#[test(should_fail)] for generic failure checks.#[test(should_fail_with = "...")] for exact error matching.Use TestEnvironment time controls for deterministic tests:
set_next_block_timestamp(timestamp)advance_next_block_timestamp_by(duration)mine_block() / mine_block_at(timestamp)This is required for lock delays, voting windows, and delayed state behavior.
createAztecNodeClient(nodeUrl) and waitForNode(node).EmbeddedWallet or test wallet wrapper).registerInitialLocalNetworkAccountsInWallet(wallet) for local-network prefunded accountsgetInitialTestAccountsData() + wallet.createSchnorrAccount(...)SinglePrivateImmutable / SinglePrivateMutable), use contract public keys when the contract owns private state, register the instance with its secret key before send, precompute the instance with the same address inputs the send path will derive (deployer: from for normal sends), and pass additionalScopes: [instance.address] — PXE-level scope enforcement in v4.2.0 rejects the constructor's access to the instance's own private slot without it. TestEnvironment honours the same enforcement as production PXE, so the option is required under both harnesses.additionalScopes..simulate(...)..send(...).wallet.executeUtility(call, opts), pass { scopes: [addr, ...] } (an AztecAddress[]); the v4.1.x scope (single address) option was renamed to scopes in v4.2.0, and the 'ALL_SCOPES' sentinel was removed.Private authwit patterns:
wallet.createAuthWit(...)authWitnessesPublic authwit patterns:
SetPublicAuthwitContractInteraction.create(..., true) and send itSetPublicAuthwitContractInteraction.create(..., false) and send itFor advanced local-network integration tests requiring governance timing and proposal state transitions, use the pinned governance testing tutorial in reference.md. Keep this as a dedicated integration track separate from standard contract unit/integration tests.
# readiness and environment checks
scripts/preflight_aztec_testing.sh [node-url]
scripts/wait_for_aztec_test_node.sh <node-url> [timeout-seconds] [interval-seconds]
# noir contract tests
scripts/run_noir_contract_tests.sh <workspace-dir> [--skip-compile]
# ts integration test setup and execution
scripts/install_aztec_testing_deps.sh <npm|yarn|pnpm> [version]
scripts/run_ts_integration_tests.sh <project-dir> <npm|yarn|pnpm> [test-script] [node-url]
# test-environment API summary helper
scripts/summarize_test_environment_api.sh <aztec-packages-dir>
aztec compile before aztec test..simulate() succeeds but .send() fails in TS:
check fee/payment/publication/network constraints.discover_note(...)/discover_note_at(...) flows are used when required.node_getNodeInfo response before running test suites.reference.md for pinned source corpus and detailed API/test matrices.patterns.md for reusable Noir and TypeScript testing templates.scripts/ for repeatable test setup and execution workflows.