commitizen-tools / commitizen

Create committing rules for projects :rocket: auto bump versions :arrow_up: and auto changelog generation :open_file_folder:
https://commitizen-tools.github.io/commitizen/
MIT License
2.51k stars 269 forks source link

Add guidelines regarding how to test plugins #937

Open ghisvail opened 11 months ago

ghisvail commented 11 months ago

Description

I recently designed and published a Commitizen plugin to recognize the commit style used by part of the PyData stack (NumPy, SciPy, Pandas, ...) and generate a KAC-like change log automatically from relevant commits.

The code for it is there if you're interested.

I found the documentation for designing plugins very good. I followed these steps and was able to test everything with dry runs and on the actual project change log.

That being said, I would like to add a test suite to avoid accidental regressions in the future. That part is not covered by the documentation, and code examples are scattered in the main commitizen repo.

Could you enhance the documentation by providing additional tips and guidelines to write an appropriate test suite for plugin designers?

Cheers, Ghis

Possible Solution

No response

Additional context

No response

Additional context

No response

woile commented 10 months ago

That's awesome! Could you provide some examples of what kind of regressions you'd like to prevent?

ghisvail commented 10 months ago

what kind of regressions you'd like to prevent?

For instance, I'd want to make sure that the version bump or the change log extraction rules are always respected.

It took me some time to fiddle with the different regexes, and I am sure they are not perfect. Adding some automated test cases could reveal some corners I have missed. Right now, I am mostly relying on --dry-run to do manual testing.