Skip to content

Commit 32fe8dc

Browse files
author
Test User
committed
test(cmd): add comprehensive test coverage for command package
Add test suites achieving >90% coverage for cmd/ package: - cmd/fmt_test.go: Format command logic, check mode, exit handling - cmd/lint_test.go: Lint command with all component types - cmd/root_test.go: Root command flags and execution - cmd/subcommands_test.go: All subcommand routing - cmd/summary_test.go: Summary display formatting Refactor cmd/fmt.go and cmd/root.go to use exitFunc variable for testability, allowing tests to override os.Exit behavior.
1 parent e847ea7 commit 32fe8dc

7 files changed

Lines changed: 4976 additions & 2 deletions

File tree

cmd/fmt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func runFmt(args []string) error {
216216

217217
// Check mode: exit 1 if files need formatting
218218
if fmtCheck && len(needsFormatting) > 0 {
219-
os.Exit(1)
219+
exitFunc(1)
220220
}
221221

222222
return nil

0 commit comments

Comments
 (0)