Skip to content
Pre-Release: Fe is under active development. This documentation covers the upcoming release. Follow progress on GitHub

The fe test Runner

The fe test command discovers, compiles, and runs all #[test] functions.

Run all tests in a file:

Terminal window
fe test my_contract.fe

Run all tests in an ingot (directory with fe.toml):

Terminal window
fe test path/to/my-ingot/

Run tests matching a pattern:

Terminal window
fe test --filter transfer my_contract.fe

The --filter option matches against test function names. Only tests containing the filter string run:

Terminal window
# Run only tests with "balance" in the name
fe test --filter balance my_contract.fe
# Run only tests with "overflow" in the name
fe test --filter overflow my_contract.fe

Tests run in parallel by default (8 workers). Control this with --jobs:

Terminal window
# Run tests sequentially
fe test --jobs 1 my_contract.fe
# Use 16 parallel workers
fe test --jobs 16 my_contract.fe

Test multiple files at once using glob patterns:

Terminal window
# All .fe files in a directory
fe test "tests/*.fe"
# All test files recursively
fe test "src/**/*.fe"

In a workspace with multiple ingots, test a specific member:

Terminal window
# Test a specific ingot by name
fe test --ingot my-lib path/to/workspace/

Show events emitted during test execution:

Terminal window
fe test --show-logs my_contract.fe

Trace EVM opcodes for debugging:

Terminal window
fe test --trace-evm my_contract.fe

Show the call trace for each test:

Terminal window
fe test --call-trace my_contract.fe

A typical test run looks like:

PASS [0.0003s] test_max
PASS [0.0003s] test_clamp
PASS [0.0004s] test_counter_contract
FAIL [0.0003s] test_broken
Test reverted: 0x
test result: FAILED. 3 passed; 1 failed
failures:
test_broken
  • PASS — Test function completed without reverting
  • FAIL — Test function reverted (or succeeded when should_revert was expected)
  • The time shown is execution time, not compilation time
OptionDescription
--filter PATTERNOnly run tests matching pattern
--jobs NParallel worker count (default: 8)
--show-logsDisplay emitted event logs
--trace-evmTrace EVM opcodes
--call-tracePrint call traces
--ingot NAMETest specific workspace member
--backend yul|sonatinaCodegen backend (default: sonatina)
--optimize 0|s|2Optimization level