Skip to content

Commit 32dd9e8

Browse files
committed
ci: fix some windows tests
1 parent 0560923 commit 32dd9e8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/Install/Mcp/FileWriter.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ protected function injectNewConfigKey(string $content): bool
187187
protected function generateServerJson(string $key, array $serverConfig, int $baseIndent = 0): string
188188
{
189189
$json = json_encode($serverConfig, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
190+
191+
// Normalize line endings to Unix style
192+
$json = str_replace("\r\n", "\n", $json);
190193

191194
// If no indentation needed, return as-is
192195
if (empty($baseIndent)) {
@@ -379,6 +382,11 @@ protected function addServersToConfig(array &$config): void
379382
protected function writeJsonConfig(array $config): bool
380383
{
381384
$json = json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
385+
386+
// Normalize line endings to Unix style
387+
if ($json) {
388+
$json = str_replace("\r\n", "\n", $json);
389+
}
382390

383391
return $json && $this->writeFile($json);
384392
}

tests/Unit/Install/GuidelineWriterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
expect(fn () => $writer->write('test guidelines'))
4949
->toThrow(RuntimeException::class, 'Failed to create directory: /root/boost_test');
50-
});
50+
})->skipOnWindows();
5151

5252
test('it writes guidelines to new file', function () {
5353
$tempFile = tempnam(sys_get_temp_dir(), 'boost_test_');
@@ -150,7 +150,7 @@
150150

151151
expect(fn () => $writer->write('test guidelines'))
152152
->toThrow(RuntimeException::class, "Failed to open file: {$dirPath}");
153-
});
153+
})->skipOnWindows();
154154

155155
test('it preserves file content structure with proper spacing', function () {
156156
$tempFile = tempnam(sys_get_temp_dir(), 'boost_test_');

0 commit comments

Comments
 (0)