@@ -152,32 +152,37 @@ func TestTrackWorkflowFailure(t *testing.T) {
152152 name string
153153 workflowPath string
154154 errorCount int
155+ errorMessages []string
155156 expectedDetails WorkflowFailure
156157 }{
157158 {
158- name : "single error" ,
159- workflowPath : ".github/workflows/test.md" ,
160- errorCount : 1 ,
159+ name : "single error" ,
160+ workflowPath : ".github/workflows/test.md" ,
161+ errorCount : 1 ,
162+ errorMessages : []string {"test error message" },
161163 expectedDetails : WorkflowFailure {
162- Path : ".github/workflows/test.md" ,
163- ErrorCount : 1 ,
164+ Path : ".github/workflows/test.md" ,
165+ ErrorCount : 1 ,
166+ ErrorMessages : []string {"test error message" },
164167 },
165168 },
166169 {
167- name : "multiple errors" ,
168- workflowPath : ".github/workflows/complex.md" ,
169- errorCount : 5 ,
170+ name : "multiple errors" ,
171+ workflowPath : ".github/workflows/complex.md" ,
172+ errorCount : 5 ,
173+ errorMessages : []string {"error 1" , "error 2" },
170174 expectedDetails : WorkflowFailure {
171- Path : ".github/workflows/complex.md" ,
172- ErrorCount : 5 ,
175+ Path : ".github/workflows/complex.md" ,
176+ ErrorCount : 5 ,
177+ ErrorMessages : []string {"error 1" , "error 2" },
173178 },
174179 },
175180 }
176181
177182 for _ , tt := range tests {
178183 t .Run (tt .name , func (t * testing.T ) {
179184 stats := & CompilationStats {}
180- trackWorkflowFailure (stats , tt .workflowPath , tt .errorCount )
185+ trackWorkflowFailure (stats , tt .workflowPath , tt .errorCount , tt . errorMessages )
181186
182187 // Check that FailedWorkflows was updated
183188 if len (stats .FailedWorkflows ) != 1 {
@@ -196,6 +201,14 @@ func TestTrackWorkflowFailure(t *testing.T) {
196201 if detail .ErrorCount != tt .expectedDetails .ErrorCount {
197202 t .Errorf ("Expected error count %d, got %d" , tt .expectedDetails .ErrorCount , detail .ErrorCount )
198203 }
204+ if len (detail .ErrorMessages ) != len (tt .expectedDetails .ErrorMessages ) {
205+ t .Errorf ("Expected %d error messages, got %d" , len (tt .expectedDetails .ErrorMessages ), len (detail .ErrorMessages ))
206+ }
207+ for i , msg := range detail .ErrorMessages {
208+ if i < len (tt .expectedDetails .ErrorMessages ) && msg != tt .expectedDetails .ErrorMessages [i ] {
209+ t .Errorf ("Expected error message %q, got %q" , tt .expectedDetails .ErrorMessages [i ], msg )
210+ }
211+ }
199212 })
200213 }
201214}
0 commit comments