Skip to content

Commit 5ce40c1

Browse files
committed
fix: unit tests on Windows
# Conflicts: # packages/qwik/src/optimizer/src/plugins/rollup.ts
1 parent 584271f commit 5ce40c1

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

packages/qwik/src/cli/add/update-files.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import fs from 'node:fs';
2-
import { extname, join } from 'node:path';
2+
import { extname, join, normalize } from 'node:path';
33
import type { FsUpdates, UpdateAppOptions } from '../types';
44
import { getPackageManager } from '../utils/utils';
55

@@ -22,12 +22,18 @@ export async function mergeIntegrationDir(
2222
const s = await fs.promises.stat(srcChildPath);
2323

2424
if (s.isDirectory()) {
25-
await mergeIntegrationDir(fileUpdates, opts, srcChildPath, destRootPath, alwaysInRoot);
25+
await mergeIntegrationDir(
26+
fileUpdates,
27+
opts,
28+
srcChildPath,
29+
normalize(destRootPath).replace(/\\/g, '/'),
30+
alwaysInRoot
31+
);
2632
} else if (s.isFile()) {
2733
const finalDestPath = getFinalDestPath(opts, destRootPath, destDir, destName, alwaysInRoot);
2834

2935
if (destName === 'package.json') {
30-
await mergePackageJsons(fileUpdates, srcChildPath, destRootPath);
36+
await mergePackageJsons(fileUpdates, srcChildPath, destRootPath.replace(/\\/g, '/'));
3137
} else if (destName === 'settings.json') {
3238
await mergeJsons(fileUpdates, srcChildPath, finalDestPath);
3339
} else if (destName === 'README.md') {
@@ -37,7 +43,7 @@ export async function mergeIntegrationDir(
3743
destName === '.prettierignore' ||
3844
destName === '.eslintignore'
3945
) {
40-
await mergeIgnoresFile(fileUpdates, srcChildPath, destRootPath);
46+
await mergeIgnoresFile(fileUpdates, srcChildPath, destRootPath.replace(/\\/g, '/'));
4147
} else if (ext === '.css') {
4248
await mergeCss(fileUpdates, srcChildPath, finalDestPath, opts);
4349
} else if (fs.existsSync(finalDestPath)) {
@@ -79,7 +85,8 @@ function getFinalDestPath(
7985
? destRootPath
8086
: destChildPath;
8187

82-
return finalDestPath;
88+
// Normalize path separators to forward slashes for cross-platform compatibility
89+
return normalize(finalDestPath).replace(/\\/g, '/');
8390
}
8491

8592
async function mergePackageJsons(fileUpdates: FsUpdates, srcPath: string, destPath: string) {

0 commit comments

Comments
 (0)