defi-wonderland / smock

The Solidity mocking library
MIT License
319 stars 40 forks source link

Using smock on a forked mainnet #169

Open derawi opened 1 year ago

derawi commented 1 year ago

Describe the bug Throws and error when running a local hardhat node with forked mainnet

Reproduction steps

npx hardhat node npm run test --network localhost

Error: Smock is only compatible with the "hardhat" network, got: localhost. Follow this issue for more info: 
https://github.com/defi-wonderland/smock/issues/29
      at Function.create (node_modules/@defi-wonderland/smock/src/sandbox.ts:58:13)
      at init (node_modules/@defi-wonderland/smock/src/index.ts:27:27)
      at Object.mock (node_modules/@defi-wonderland/smock/src/index.ts:21:23)
wei3erHase commented 1 year ago

Have u tried with 'hardhat' pal?

derawi commented 1 year ago

yes this works, but this will spin up a new empty/or forked network and close it after the test is finished.

What I want to do is a 2step process: 1)testing against "new" network hardhat (working) 2) testing against a running local node