Open fvictorio opened 1 year ago
I'm also seeing this issue with fixtures + hardhat_reset
on any test, our workaround was to run this test which required rest without fixtures (and separately from the rest of our tests with fixtures).
hi @fvictorio ,am working on this issue..
There was an error reverting the snapshot of the fixture.
This might be caused by using hardhat_reset and loadFixture calls in a testcase.
any thoughts about this idea?
I think Im facing this issue!
What is strange in my case is that i works locally but not in CI. When the test runs in Github actions I get: What could be the reason Im only seeing the error in CI? Is there a workaround?
I do not have nested beforeEach, but I do a network reset and then a beforeEach that deploys a lot of contracts, and performs impersonation, etc.
FixtureSnapshotError: There was an error reverting the snapshot of the fixture.
This might be caused by using nested loadFixture calls in a test, for example by using multiple beforeEach calls. This is not supported yet.
at loadFixture (/home/runner/work/protocol/protocol/node_modules/@nomicfoundation/hardhat-network-helpers/src/loadFixture.ts:51:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)
at processImmediate (node:internal/timers:437:9)
at async Context.<anonymous> (/home/runner/work/protocol/protocol/test/integration/FacadeMonitorNew.test.ts:159:9)
Caused by: InvalidSnapshotError: Trying to restore an invalid snapshot.
at Object.restore (/home/runner/work/protocol/protocol/node_modules/@nomicfoundation/hardhat-network-helpers/src/helpers/takeSnapshot.ts:46:15)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at runNextTicks (node:internal/process/task_queues:65:3)
at processImmediate (node:internal/timers:437:9)
at async loadFixture (/home/runner/work/protocol/protocol/node_modules/@nomicfoundation/hardhat-network-helpers/src/loadFixture.ts:44:7)
...
If you use fixtures and
hardhat_reset
, you will likely run into an error like:That message is misleading, and also a lie: we support nested loadFixture calls now.
Two things to do here: