Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modifierWhitelist causes inaccurate coverage #823

Open
BlockAlchemist opened this issue Dec 21, 2023 · 3 comments
Open

modifierWhitelist causes inaccurate coverage #823

BlockAlchemist opened this issue Dec 21, 2023 · 3 comments

Comments

@BlockAlchemist
Copy link

When using the modifierWhitelist option in the sol coverage config. It correctly excludes the modifiers specified however it also causes random pasts of coverage to go missing.

@cgewecke
Copy link
Member

@BlockAlchemist Apologies for the late response.

Do you have a link to a public repo where I could see this happening? Or some way of reproducing this problem?

It's possible that running hardhat clean would resolve this...solidity-coverage sometimes behaves weirdly if you change the .solcover configuration between coverage runs.

@BlockAlchemist
Copy link
Author

@BlockAlchemist Apologies for the late response.

Do you have a link to a public repo where I could see this happening? Or some way of reproducing this problem?

It's possible that running hardhat clean would resolve this...solidity-coverage sometimes behaves weirdly if you change the .solcover configuration between coverage runs.

Hey thanks for your response! I don't think hardhat clean fixes the issue because I've run this in the past as part of a script that firstly clears the cache then runs the coverage report. I believe the issue occurs when there are many contracts and tests running. On the projects I've encountered this issue on there have been 1k+ unit tests. I've attempted to reproduce this doing a simple set of tests and I was unable to replicate the issue.

@cgewecke
Copy link
Member

@BlockAlchemist Ok, thanks for reporting. Will keep a lookout for this.

Another possibility based on your description is that there's a missing await somewhere in the test suite or some non-deterministic time-based logic. Enabling or disabling the modifier coverage will change how long it takes the client to run the code and this might result in variance.

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

No branches or pull requests

2 participants