In the real app, I'm using the web3-react hook to inject the provider, etc. How do I best mock that/replicate that in a Jest Typescript environment?

1 Answer 1


I was running with this problem and you can inject it with ganache-cli

const ethereumObject = require("ganache-cli").provider();

You can check out more here: https://michalzalecki.com/integration-tests-with-web3-ganache-cli-and-jest/ - I'm using ethers and it works!

Kinda late but I hope this helps someone


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.