(t *testing.T)
| 837 | } |
| 838 | |
| 839 | func 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 | |
| 872 | func TestReportCommand_ColoredSections(t *testing.T) { |
| 873 | tmpDir := createReportTestFiles(t) |
nothing calls this directly
no test coverage detected