alexfertel / bulloak

A Solidity test generator based on the Branching Tree Technique.
Apache License 2.0
225 stars 13 forks source link

Feature request: Ignore modifier definitions in the test contract #66

Closed smol-ninja closed 4 weeks ago

smol-ninja commented 1 month ago

Background

Bulloak treats test contracts independently from one another. This design choice necessitates defining modifiers within the same file as the test contract. However, in large projects where modifiers are shared among tests, this contradicts the principle of DRY.

Feature Request

PaulRBerg commented 1 month ago

Here's an example of shared modifiers in Sablier:

https://github.com/sablier-labs/v2-core/blob/56ce2b994519d327143784ef58546a401ce0507a/test/integration/shared/lockup/withdraw.t.sol

alexfertel commented 1 month ago

Sounds reasonable 👍 Will work on it!

PaulRBerg commented 1 month ago

Alternatively, other than ignoring, it would be helpful if Bulloak could infer that the modifier is imported in the file, and don't throw any warning.

smol-ninja commented 1 month ago

@alexfertel is there any ETA on this feature?

I would also like to commend you on writing this library. Bulloak has made life so much easier for me. I can just run the command and find missing or incorrectly named tests 🥳.

Screenshot 2024-06-06 at 10 24 15

Let me know if I can support you with a small donation.

alexfertel commented 1 month ago

Thanks for the kind words! I'm happy it's been a helpful tool for you.

is there any ETA on this feature?

Unfortunately, I've been quite busy, so I'm not sure when I'll get some time to work on this. Sorry for the trouble.

Feel free to give this a shot in the meantime. Otherwise, I'll try to work on it soon.

PaulRBerg commented 1 month ago

@alexfertel Sablier donated 500 USDC to you:

https://arbiscan.io/tx/0xde2b3b782ca03b5898a9ed4c91134c5635ad81cc59bf596db99461e6bb562b51

alexfertel commented 1 month ago

Wow, thank you! I was not expecting that 🙇‍♂️

alexfertel commented 4 weeks ago

@smol-ninja would you mind installing bulloak from git and checking if your workflow works with the --skip-modifiers flag?

I did a few tests, but I'm not sure if I covered your use cases. If I missed anything lmk, I'll wait for your feedback before cutting a release.

smol-ninja commented 4 weeks ago

Hey @alexfertel I tested the latest code, and it works great. Both scaffold and check are able to skip modifiers with the flag. This is just perfect.

Thank you so much and have a great evening.

alexfertel commented 4 weeks ago

Great! I'm glad it works well 😌

I'll cut a release first thing tomorrow morn so that you can install as usual.