hardhat-watcher icon indicating copy to clipboard operation
hardhat-watcher copied to clipboard

Local network not restarting for every run

Open ohaponiuk opened this issue 3 years ago • 5 comments

I noticed that when I run tests with hardhat-watcher on local hardhat network if I spam tests, signers' balances don't reset and I get weird bugs where they don't have enough funds because they used them in the previous run of the same test.

ohaponiuk avatar Dec 20 '21 10:12 ohaponiuk

@xanderdeseyn Is there any update on this? I'm having the same issue.

alexandrethsilva avatar Aug 20 '22 14:08 alexandrethsilva

Same here. I have issues when using evm_increaseTime and the test restart sometime and local hardhat is not restarted

arodundef avatar Oct 21 '22 01:10 arodundef

@ohaponiuk , are you resetting it via await hre.network.provider.send("hardhat_reset") ?

Source

sahilrajput03 avatar Oct 21 '22 13:10 sahilrajput03

It doesn't work properly. Using only in the function that I need to reset causes this:

@nomicfoundation/hardhat-chai-matchers/src/internal/reverted/reverted.ts:31
          receipt.status === 0,
                  ^
TypeError: Cannot read properties of null (reading 'status')

The idea of using loadFixture from hardhat is already to have a clean and reset node in each test, without the necessity to use beforeEach and afterEach (which will break if you try to reset the node state again). It works when running tests without test watcher, even if you use many time travel functions.

arodundef avatar Oct 21 '22 14:10 arodundef

can you provide a MRE please?

sahilrajput03 avatar Oct 21 '22 14:10 sahilrajput03