feat: added commitizen support (due to cmd execution styles this will not be in the test suite)

Due to the way that the interactive cli call has to be made there is no
good way to automate the tests for it without spending a long time
trying to understand go pipes. since this is more of an extra feature
anyways I am fine with leaving this somewhat untested especially since
it is small isolated code
This commit is contained in:
Slug-Boi
2024-10-31 21:24:17 +01:00
parent c92079f6cd
commit b1c4df81c8
5 changed files with 143 additions and 48 deletions
+6 -8
View File
@@ -32,15 +32,13 @@ func teardown() {
os.Setenv("author_file", envVar)
}
//Skip cobra cmd tests on CI causes problems apparenly idk why
// Skip cobra cmd tests on CI causes problems apparenly idk why
// test will be run locally before releasing a new version
func skipCI(t *testing.T) {
if os.Getenv("CI") != "" {
t.Skip("Skipping testing in CI environment")
t.Skip("Skipping testing in CI environment")
}
}
}
func StdoutReader() (chan string, *os.File, *os.File, *os.File) {
old := os.Stdout
@@ -111,7 +109,7 @@ func Test_CommitCmd(t *testing.T) {
outC <- buf.String()
}()
cmd := rootCmD
cmd := rootCmd
cmd.SetArgs([]string{"-t", "Test commit message"})
cmd.Execute()
@@ -142,7 +140,7 @@ func Test_CommitCmdWithM(t *testing.T) {
outC <- buf.String()
}()
cmd := rootCmD
cmd := rootCmd
cmd.SetArgs([]string{"-m", "-t", "Test commit message"})
cmd.Execute()
@@ -157,6 +155,6 @@ func Test_CommitCmdWithM(t *testing.T) {
t.Errorf("Expected to find 'Test commit message' in output but got %s", outStr)
}
}
// root CMD TEST END