Skip to main content

Testing

Running tests

Execute the test suite with:
This command performs the following actions:
  1. Builds the project (yarn build)
  2. Runs Jest tests against the compiled output in ./dist

Test configuration

Jest testing is configured through package.json:

Test structure

Test files are colocated with source files using the .spec.ts extension:

Coverage collection

Jest collects coverage metrics from all TypeScript files in src, while excluding:
  • abi/ directory (contract ABIs)
  • types/ directory (generated types)

Testing considerations

Integration tests

For blockchain interaction testing:
  • Tests execute against compiled JavaScript in ./dist
  • Build the project before running tests
  • Mock RPC calls in unit tests

Test isolation

Configuration settings for test isolation:
  • automock: false - Requires manual mock setup
  • resetMocks: false - Mocks carry between tests unless reset explicitly

Running specific tests

Execute an individual test file:
For development iteration with watch mode:
Last modified on March 4, 2026