@@ -1705,3 +1705,66 @@ def test_is_initial_tag(mocker: MockFixture, tmp_commitizen_project):
17051705 # Test case 4: No current tag, user denies
17061706 mocker .patch ("questionary.confirm" , return_value = mocker .Mock (ask = lambda : False ))
17071707 assert bump_cmd ._is_initial_tag (None , is_yes = False ) is False
1708+
1709+
1710+ @pytest .mark .parametrize ("test_input" , ["rc" , "alpha" , "beta" ])
1711+ @pytest .mark .usefixtures ("tmp_commitizen_project" )
1712+ @pytest .mark .freeze_time ("2025-01-01" )
1713+ def test_changelog_config_flag_merge_prerelease (
1714+ mocker : MockFixture , changelog_path , config_path , file_regression , test_input
1715+ ):
1716+ with open (config_path , "a" ) as f :
1717+ f .write ("changelog_merge_prerelease = true\n " )
1718+ f .write ("update_changelog_on_bump = true\n " )
1719+ f .write ("annotated_tag = true\n " )
1720+
1721+ create_file_and_commit ("irrelevant commit" )
1722+ mocker .patch ("commitizen.git.GitTag.date" , "1970-01-01" )
1723+ git .tag ("0.1.0" )
1724+
1725+ create_file_and_commit ("feat: add new output" )
1726+ create_file_and_commit ("fix: output glitch" )
1727+ testargs = ["cz" , "bump" , "--prerelease" , test_input , "--yes" ]
1728+ mocker .patch .object (sys , "argv" , testargs )
1729+ cli .main ()
1730+
1731+ testargs = ["cz" , "bump" , "--changelog" ]
1732+ mocker .patch .object (sys , "argv" , testargs )
1733+ cli .main ()
1734+
1735+ with open (changelog_path ) as f :
1736+ out = f .read ()
1737+
1738+ file_regression .check (out , extension = ".md" )
1739+
1740+
1741+ @pytest .mark .parametrize ("test_input" , ["rc" , "alpha" , "beta" ])
1742+ @pytest .mark .usefixtures ("tmp_commitizen_project" )
1743+ @pytest .mark .freeze_time ("2025-01-01" )
1744+ def test_changelog_config_flag_merge_prerelease_only_prerelease_present (
1745+ mocker : MockFixture , changelog_path , config_path , file_regression , test_input
1746+ ):
1747+ with open (config_path , "a" ) as f :
1748+ f .write ("changelog_merge_prerelease = true\n " )
1749+ f .write ("update_changelog_on_bump = true\n " )
1750+ f .write ("annotated_tag = true\n " )
1751+
1752+ create_file_and_commit ("feat: more relevant commit" )
1753+ testargs = ["cz" , "bump" , "--prerelease" , test_input , "--yes" ]
1754+ mocker .patch .object (sys , "argv" , testargs )
1755+ cli .main ()
1756+
1757+ create_file_and_commit ("feat: add new output" )
1758+ create_file_and_commit ("fix: output glitch" )
1759+ testargs = ["cz" , "bump" , "--prerelease" , test_input , "--yes" ]
1760+ mocker .patch .object (sys , "argv" , testargs )
1761+ cli .main ()
1762+
1763+ testargs = ["cz" , "bump" , "--changelog" ]
1764+ mocker .patch .object (sys , "argv" , testargs )
1765+ cli .main ()
1766+
1767+ with open (changelog_path ) as f :
1768+ out = f .read ()
1769+
1770+ file_regression .check (out , extension = ".md" )
0 commit comments