@@ -178,19 +178,26 @@ func isCIEnvironment() bool {
178
178
return os .Getenv ("CI" ) != ""
179
179
}
180
180
181
- // sanitizeOutput replaces the absolute repository root path in the provided output
182
- // with the placeholder "/absolute/path/to/repo".
183
- // It returns an error if the repository root cannot be determined.
181
+ // sanitizeOutput replaces occurrences of the repository's absolute path in the output
182
+ // with the placeholder "/absolute/path/to/repo". It first normalizes both the repository root
183
+ // and the output to use forward slashes, ensuring that the replacement works reliably.
184
+ // An error is returned if the repository root cannot be determined.
184
185
func sanitizeOutput (output string ) (string , error ) {
185
- repoRoot , err := findGitRepoRoot (startingDir )
186
+ repoRoot , err := findGitRepoRoot ()
186
187
if err != nil {
187
188
return "" , err
188
189
}
190
+
189
191
if repoRoot == "" {
190
192
return "" , errors .New ("failed to determine repository root" )
191
193
}
192
- // Replace all instances of the repo root with the placeholder.
193
- return strings .ReplaceAll (output , repoRoot , "/absolute/path/to/repo" ), nil
194
+ // Normalize the repository root and output to use forward slashes.
195
+ normalizedRepoRoot := filepath .ToSlash (repoRoot )
196
+ normalizedOutput := filepath .ToSlash (output )
197
+
198
+ // Replace all occurrences of the normalized repository root with the placeholder.
199
+ sanitized := strings .ReplaceAll (normalizedOutput , normalizedRepoRoot , "/absolute/path/to/repo" )
200
+ return sanitized , nil
194
201
}
195
202
196
203
// sanitizeTestName converts t.Name() into a valid filename.
0 commit comments