MCPcopy Create free account
hub / github.com/driangle/taskmd / TestReportCommand_FileOutputNoColor

Function TestReportCommand_FileOutputNoColor

apps/cli/internal/cli/report_test.go:839–870  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

837}
838
839func TestReportCommand_FileOutputNoColor(t *testing.T) {
840 tmpDir := createReportTestFiles(t)
841 outFile := filepath.Join(t.TempDir(), "report.md")
842
843 resetReportFlags()
844 reportOut = outFile
845 noColor = false
846 forceColor = true
847 defer func() { forceColor = false }()
848
849 os.Unsetenv("NO_COLOR")
850
851 err := runReport(reportCmd, []string{tmpDir})
852 if err != nil {
853 t.Fatalf("runReport failed: %v", err)
854 }
855
856 content, err := os.ReadFile(outFile)
857 if err != nil {
858 t.Fatalf("Failed to read output file: %v", err)
859 }
860
861 // File output should NOT contain ANSI escape codes
862 if strings.Contains(string(content), "\x1b[") {
863 t.Error("Expected no ANSI codes in file output")
864 }
865
866 // Content should still be present
867 if !strings.Contains(string(content), "Project Report") {
868 t.Error("Expected report heading in file output")
869 }
870}
871
872func TestReportCommand_ColoredSections(t *testing.T) {
873 tmpDir := createReportTestFiles(t)

Callers

nothing calls this directly

Calls 4

createReportTestFilesFunction · 0.85
resetReportFlagsFunction · 0.85
runReportFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected