Skip to content

Commit 0c0cd2b

Browse files
committed
Fix additional Windows CI issue: Escape file paths in JSON replacement
- Fixed CliWorkflow_WithConfigFileOutputSettings_ShouldUseConfigurationValues test - Added proper JSON escaping when replacing paths in config file content - Use .Replace('\', '\\') to escape backslashes for Windows paths - Resolves JSON parsing error: 'U' is an invalid escapable character This complements the previous Windows CI fix and ensures all integration tests work correctly on Windows by properly escaping file paths when they are inserted into JSON configuration files.
1 parent ce602cd commit 0c0cd2b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/DotNetApiDiff.Tests/Integration/CliWorkflowTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ public void CliWorkflow_WithConfigFileOutputSettings_ShouldUseConfigurationValue
185185

186186
// Update the config file to use our temp output path
187187
var configContent = File.ReadAllText(configFile);
188-
var configWithTempPath = configContent.Replace("comparison-report.html", expectedOutputFile);
188+
// Escape backslashes for JSON format on Windows
189+
var escapedOutputPath = expectedOutputFile.Replace("\\", "\\\\");
190+
var configWithTempPath = configContent.Replace("comparison-report.html", escapedOutputPath);
189191
var tempConfigFile = Path.Combine(_tempOutputPath, "temp-config.json");
190192
File.WriteAllText(tempConfigFile, configWithTempPath);
191193

0 commit comments

Comments
 (0)