@@ -69,30 +69,26 @@ async function main() {
6969 // Process failed tests
7070 if ( event . Action === "fail" && event . Test ) {
7171 const outputs = testOutputs . get ( event . Test ) || [ ] ;
72- const fullOutput = outputs . join ( "" ) ;
73-
74- // Check if this is a baseline-only failure
75- // Baseline failures contain specific messages from baseline.go
76- const hasBaselineMessage = / n e w b a s e l i n e c r e a t e d a t / . test ( fullOutput ) ||
77- / t h e b a s e l i n e f i l e .* h a s c h a n g e d / . test ( fullOutput ) ;
78-
79- // Check for non-baseline errors
80- // Look for patterns that indicate real test failures
81- // We need to filter out baseline messages when checking for errors
82- const outputWithoutBaseline = fullOutput
83- . replace ( / t h e b a s e l i n e f i l e .* h a s c h a n g e d \. \( R u n ` h e r e b y b a s e l i n e - a c c e p t ` i f t h e n e w b a s e l i n e i s c o r r e c t \. \) / g, "" )
84- . replace ( / n e w b a s e l i n e c r e a t e d a t .* \. / g, "" )
85- . replace ( / t h e b a s e l i n e f i l e .* d o e s n o t e x i s t i n t h e T y p e S c r i p t s u b m o d u l e / g, "" )
86- . replace ( / t h e b a s e l i n e f i l e .* d o e s n o t m a t c h t h e r e f e r e n c e i n t h e T y p e S c r i p t s u b m o d u l e / g, "" ) ;
87-
88- const hasNonBaselineError = / ^ p a n i c / m. test ( outputWithoutBaseline ) ||
89- / E r r o r | e r r o r / i. test ( outputWithoutBaseline ) ||
90- / f a t a l | F a t a l / . test ( outputWithoutBaseline ) ||
91- / U n e x p e c t e d / . test ( outputWithoutBaseline ) ;
92-
93- // Only mark as failing if it's not a baseline-only failure
94- // (i.e., if there's no baseline message, or if there are other errors besides baseline)
95- if ( ! hasBaselineMessage || hasNonBaselineError ) {
72+
73+ // A test is only considered a baseline-only failure if ALL error messages
74+ // are baseline-related. Any non-baseline error message means it's a real failure.
75+ const baselineMessagePatterns = [
76+ / ^ \s * b a s e l i n e \. g o : \d + : t h e b a s e l i n e f i l e .* h a s c h a n g e d \. / ,
77+ / ^ \s * b a s e l i n e \. g o : \d + : n e w b a s e l i n e c r e a t e d a t / ,
78+ / ^ \s * b a s e l i n e \. g o : \d + : t h e b a s e l i n e f i l e .* d o e s n o t e x i s t i n t h e T y p e S c r i p t s u b m o d u l e / ,
79+ / ^ \s * b a s e l i n e \. g o : \d + : t h e b a s e l i n e f i l e .* d o e s n o t m a t c h t h e r e f e r e n c e i n t h e T y p e S c r i p t s u b m o d u l e / ,
80+ ] ;
81+
82+ // Check each output line that looks like an error message
83+ // Error messages from Go tests typically contain ".go:" with a line number
84+ const errorLines = outputs . filter ( line => / ^ \s * \w + \. g o : \d + : / . test ( line ) ) ;
85+
86+ // If there are no error lines, it's a real failure.
87+ // If all error lines match baseline patterns, it's a baseline-only failure
88+ const isBaselineOnlyFailure = errorLines . length > 0 &&
89+ errorLines . every ( line => baselineMessagePatterns . some ( pattern => pattern . test ( line ) ) ) ;
90+
91+ if ( ! isBaselineOnlyFailure ) {
9692 failingTests . push ( event . Test ) ;
9793 }
9894 }
0 commit comments