Skip to content

Commit 74a6922

Browse files
committed
feat: new file
1 parent be115cd commit 74a6922

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

701a8810-6c9c-4b1c-a037-1894fbecb80d

Whitespace-only changes.

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,5 @@ known_first_party = ["commitizen", "tests"]
132132
[build-system]
133133
requires = ["poetry_core>=1.0.0"]
134134
build-backend = "poetry.core.masonry.api"
135+
tag_format = "$version"
136+
change_type_order = ["BREAKING CHANGE", "Perf", "Fix", "Feat", "Refactor"]

tests/commands/test_changelog_command.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,3 +866,47 @@ def test_invalid_subject_is_skipped(mocker, capsys):
866866
out, _ = capsys.readouterr()
867867

868868
assert out == ("## Unreleased\n\n### Feat\n\n- a new world\n\n")
869+
870+
871+
@pytest.mark.freeze_time("2022-02-13")
872+
def test_changelog_with_customized_change_type_order(
873+
mocker, config_path, changelog_path, file_regression
874+
):
875+
mocker.patch("commitizen.git.GitTag.date", "2022-02-13")
876+
877+
with open(config_path, "a") as f:
878+
f.write('tag_format = "$version"\n')
879+
f.write(
880+
'change_type_order = ["BREAKING CHANGE", "Perf", "Fix", "Feat", "Refactor"]\n'
881+
)
882+
883+
# create commit and tag
884+
create_file_and_commit("feat: new file")
885+
testargs = ["cz", "bump", "--yes"]
886+
mocker.patch.object(sys, "argv", testargs)
887+
cli.main()
888+
wait_for_tag()
889+
create_file_and_commit("feat: after 0.2.0")
890+
create_file_and_commit("feat: another feature")
891+
create_file_and_commit("fix: fix bug")
892+
893+
testargs = ["cz", "bump", "--yes"]
894+
mocker.patch.object(sys, "argv", testargs)
895+
cli.main()
896+
wait_for_tag()
897+
898+
create_file_and_commit("feat: getting ready for this")
899+
create_file_and_commit("perf: perf improvement")
900+
901+
testargs = ["cz", "bump", "--yes"]
902+
mocker.patch.object(sys, "argv", testargs)
903+
cli.main()
904+
wait_for_tag()
905+
906+
testargs = ["cz", "changelog", "0.3.0..0.4.0"]
907+
mocker.patch.object(sys, "argv", testargs)
908+
cli.main()
909+
with open(changelog_path, "r") as f:
910+
out = f.read()
911+
912+
file_regression.check(out, extension=".md")
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## 0.4.0 (2022-02-13)
2+
3+
### Perf
4+
5+
- perf improvement
6+
7+
### Feat
8+
9+
- getting ready for this
10+
11+
## 0.3.0 (2022-02-13)
12+
13+
### Fix
14+
15+
- fix bug
16+
17+
### Feat
18+
19+
- another feature
20+
- after 0.2.0

0 commit comments

Comments
 (0)