Skip to content

Commit b0f4265

Browse files
committed
fix: normalize path separators for cross-platform test compatibility
1 parent cdaa0f8 commit b0f4265

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"lingo.dev": patch
3+
---
4+
5+
Fix CLI tests failing on Windows due to path separator differences

packages/cli/src/cli/utils/buckets.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ function expandPlaceholderedGlob(
175175
const placeholderedPath = sourcePathChunks.join(path.sep);
176176
return placeholderedPath;
177177
});
178-
// return the placeholdered paths
179-
return placeholderedPaths;
178+
// return the placeholdered paths (normalized to forward slashes for cross-platform compatibility)
179+
return placeholderedPaths.map(p => p.replace(/\\/g, "/"));
180180
}
181181

182182
function resolveBucketItem(bucketItem: string | BucketItem): BucketItem {

packages/cli/src/cli/utils/find-locale-paths.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function findLocaleFilesForFilename(fileName: string) {
9595

9696
const localeFilesAndPatterns = localeFiles.map((file: string) => ({
9797
file,
98-
pattern: path.join(path.dirname(file), pattern),
98+
pattern: path.join(path.dirname(file), pattern).replace(/\\/g, "/"),
9999
}));
100100
const grouppedFilesAndPatterns = _.groupBy(localeFilesAndPatterns, "pattern");
101101
const patterns = Object.keys(grouppedFilesAndPatterns);

0 commit comments

Comments
 (0)