|
10 | 10 | example = "feature: this feature enable customize through config file" |
11 | 11 | schema = "<type>: <body>" |
12 | 12 | schema_pattern = "(feature|bug fix):(\\s.*)" |
| 13 | + commit_parser = "^(?P<change_type>feature|bug fix):\\s(?P<message>.*)?" |
| 14 | + changelog_pattern = "^(feature|bug fix)?(!)?" |
| 15 | + change_type_map = {"feature" = "Feat", "bug fix" = "Fix"} |
13 | 16 |
|
14 | 17 | bump_pattern = "^(break|new|fix|hotfix)" |
15 | 18 | bump_map = {"break" = "MAJOR", "new" = "MINOR", "fix" = "PATCH", "hotfix" = "PATCH"} |
|
57 | 60 | "fix": "PATCH", |
58 | 61 | "hotfix": "PATCH" |
59 | 62 | }, |
| 63 | + "commit_parser": "^(?P<change_type>feature|bug fix):\\s(?P<message>.*)?", |
| 64 | + "changelog_pattern": "^(feature|bug fix)?(!)?", |
| 65 | + "change_type_map": {"feature": "Feat", "bug fix": "Fix"}, |
60 | 66 | "change_type_order": ["perf", "BREAKING CHANGE", "feat", "fix", "refactor"], |
61 | 67 | "info": "This is a customized cz.", |
62 | 68 | "questions": [ |
@@ -363,3 +369,18 @@ def test_info_with_info_path(tmpdir, config_info): |
363 | 369 | def test_info_without_info(config_without_info): |
364 | 370 | cz = CustomizeCommitsCz(config_without_info) |
365 | 371 | assert cz.info() is None |
| 372 | + |
| 373 | + |
| 374 | +def test_commit_parser(config): |
| 375 | + cz = CustomizeCommitsCz(config) |
| 376 | + assert cz.commit_parser == "^(?P<change_type>feature|bug fix):\\s(?P<message>.*)?" |
| 377 | + |
| 378 | + |
| 379 | +def test_changelog_pattern(config): |
| 380 | + cz = CustomizeCommitsCz(config) |
| 381 | + assert cz.changelog_pattern == "^(feature|bug fix)?(!)?" |
| 382 | + |
| 383 | + |
| 384 | +def test_change_type_map(config): |
| 385 | + cz = CustomizeCommitsCz(config) |
| 386 | + assert cz.change_type_map == {"feature": "Feat", "bug fix": "Fix"} |
0 commit comments