Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Not working properly when tests are written using Waffle #267

Closed
Bolee95 opened this issue Dec 1, 2021 · 1 comment
Closed

Not working properly when tests are written using Waffle #267

Bolee95 opened this issue Dec 1, 2021 · 1 comment

Comments

@Bolee95
Copy link

Bolee95 commented Dec 1, 2021

Hi everyone,

I'm working on a project using the Truffle framework for development, Ganache as a local network and Waffle for testing. The reason I don't use native testing for Truffle is that I find creating mocks easily a really convenient tool, and with Waffle, it doesn't require creating new contracts with almost copied logic as the original one.

I was trying to get gas usage of the methods called during unit testing using eth-gas-reporter, but I cannot generate a report with methods gas usage. However, I do get contacts deployment gas usage.

Something that I think is causing this is that I do not use artefacts generated during truffle deploy command. I use files with generated ABI and bytecode, as I couldn't use artefacts in combination with Waffle, which operates with Ethers.js in the background.
Screenshot 2021-12-01 at 14 15 39

Screenshot 2021-12-01 at 14 15 34

This is a report generated after running tests:
Screenshot 2021-12-01 at 14 17 43

Does this ring any bell? Do I need to somehow configure the reporter differently? As you can see, the reporter is running during tests, so that's not an issue.

Would be really grateful if anyone got an answer. If you need more information, please ping me, I will provide it.

@cgewecke
Copy link
Owner

Hi! eth-gas-reporter is being deprecated in favor of hardhat-gas-reporter.

In the latest version at Hardhat, waffle should work as expected using the hardhat-waffle plugin

https://github.com/cgewecke/hardhat-gas-reporter/releases/tag/v2.0.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants