Cyfrin / foundry-smart-contract-lottery-cu

48 stars 42 forks source link

setUp failed reason="You have an active broadcast already." #22

Closed psych2go closed 1 year ago

psych2go commented 1 year ago

When testing an error occured. command: forge test error:

2023-07-25T14:32:44.344858Z ERROR forge::runner: setUp failed reason="You have an active broadcast already." contract=0x34a1d3fff3958843c43ad80f30b94c510645c316

Running 1 test for test/unit/RaffleTest.t.sol:RaffleTest
[FAIL. Reason: Setup failed: You have an active broadcast already.] setUp() (gas: 0)
Test result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 4.74ms
Ran 1 test suites: 0 tests passed, 1 failed, 0 skipped (1 total tests)

Failing tests:
Encountered 1 failing test in test/unit/RaffleTest.t.sol:RaffleTest
[FAIL. Reason: Setup failed: You have an active broadcast already.] setUp() (gas: 0)

Encountered a total of 1 failing tests, 0 tests succeeded

How I fix it?

psych2go commented 1 year ago

I put the "vm.stopBroadcast();" in the wrong place!