The fe test Runner
The fe test command discovers, compiles, and runs all #[test] functions.
Basic Usage
Section titled “Basic Usage”Run all tests in a file:
fe test my_contract.feRun all tests in an ingot (directory with fe.toml):
fe test path/to/my-ingot/Run tests matching a pattern:
fe test --filter transfer my_contract.feFiltering Tests
Section titled “Filtering Tests”The --filter option matches against test function names. Only tests containing the filter string run:
# Run only tests with "balance" in the namefe test --filter balance my_contract.fe
# Run only tests with "overflow" in the namefe test --filter overflow my_contract.feParallelism
Section titled “Parallelism”Tests run in parallel by default (8 workers). Control this with --jobs:
# Run tests sequentiallyfe test --jobs 1 my_contract.fe
# Use 16 parallel workersfe test --jobs 16 my_contract.feGlob Patterns
Section titled “Glob Patterns”Test multiple files at once using glob patterns:
# All .fe files in a directoryfe test "tests/*.fe"
# All test files recursivelyfe test "src/**/*.fe"Workspace Testing
Section titled “Workspace Testing”In a workspace with multiple ingots, test a specific member:
# Test a specific ingot by namefe test --ingot my-lib path/to/workspace/Debugging Options
Section titled “Debugging Options”Event Logs
Section titled “Event Logs”Show events emitted during test execution:
fe test --show-logs my_contract.feEVM Traces
Section titled “EVM Traces”Trace EVM opcodes for debugging:
fe test --trace-evm my_contract.feCall Traces
Section titled “Call Traces”Show the call trace for each test:
fe test --call-trace my_contract.feOutput Format
Section titled “Output Format”A typical test run looks like:
PASS [0.0003s] test_maxPASS [0.0003s] test_clampPASS [0.0004s] test_counter_contractFAIL [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_revertwas expected) - The time shown is execution time, not compilation time
Summary of CLI Options
Section titled “Summary of CLI Options”| Option | Description |
|---|---|
--filter PATTERN | Only run tests matching pattern |
--jobs N | Parallel worker count (default: 8) |
--show-logs | Display emitted event logs |
--trace-evm | Trace EVM opcodes |
--call-trace | Print call traces |
--ingot NAME | Test specific workspace member |
--backend yul|sonatina | Codegen backend (default: sonatina) |
--optimize 0|s|2 | Optimization level |