incompatibility with trace verbosity and fail fast #6613
Closed
Description
Component
Forge
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
forge 0.2.0 (88ae503 2023-12-17T00:18:48.520002484Z)
What command(s) is the bug in?
forge test -vvv --fail-fast
Operating System
Linux
Describe the bug
when using -vvv
(or any level verbosity) with --fail-fast
no traces are shown for failing tests
minimal repo:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {Test, console2} from "forge-std/Test.sol";
import {Counter} from "../src/Counter.sol";
contract CounterTest is Test {
Counter public counter;
function setUp() public {
counter = new Counter();
counter.setNumber(0);
}
function test_Fail() public {
counter.setNumber(1);
assertEq(counter.number(), 2);
}
}
when running forge test -vvv --fail-fast
no traces are shown
[⠒] Compiling...
No files changed, compilation skipped
Running 1 test for test/Counter.t.sol:CounterTest
[FAIL. Reason: assertion failed] test_Fail() (gas: 42826)
Ran 1 test suites: 0 tests passed, 0 failed, 0 skipped (0 total tests)
Failing tests:
Encountered 1 failing test in test/Counter.t.sol:CounterTest
[FAIL. Reason: assertion failed] test_Fail() (gas: 42826)
Encountered a total of 1 failing tests, 0 tests succeeded
expected behavior should be similar to forge test -vvv
[⠒] Compiling...
No files changed, compilation skipped
Running 1 test for test/Counter.t.sol:CounterTest
[FAIL. Reason: assertion failed] test_Fail() (gas: 42826)
Logs:
Error: a == b not satisfied [uint]
Left: 1
Right: 2
Traces:
[42826] CounterTest::test_Fail()
├─ [22290] Counter::setNumber(1)
│ └─ ← ()
├─ [283] Counter::number() [staticcall]
│ └─ ← 1
├─ emit log(val: "Error: a == b not satisfied [uint]")
├─ emit log_named_uint(key: " Left", val: 1)
├─ emit log_named_uint(key: " Right", val: 2)
├─ [0] VM::store(VM: [0x7109709ECfa91a80626fF3989D68f67F5b1DD12D], 0x6661696c65640000000000000000000000000000000000000000000000000000, 0x0000000000000000000000000000000000000000000000000000000000000001)
│ └─ ← ()
└─ ← ()
Test result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 861.88µs
Ran 1 test suites: 0 tests passed, 1 failed, 0 skipped (1 total tests)
Failing tests:
Encountered 1 failing test in test/Counter.t.sol:CounterTest
[FAIL. Reason: assertion failed] test_Fail() (gas: 42826)
Encountered a total of 1 failing tests, 0 tests succeeded