Skip to content

Commit 417d62a

Browse files
committed
More Windows fixes
1 parent d93d455 commit 417d62a

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

nx.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,8 @@
3333
"cacheDirectory": ".nxcache",
3434
"tui": {
3535
"autoExit": true
36+
},
37+
"nxCloudOptions": {
38+
"detectFlakyTasks": false
3639
}
3740
}

packages/integration-tests-next/fixtures/utils.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import { join } from "node:path";
55
const DEBUG = !!process.env["DEBUG"];
66
const CURRENT_SHA = execSync("git rev-parse HEAD", { encoding: "utf-8" }).trim();
77

8+
type SourceMap = {
9+
sources: string[];
10+
sourcesContent: string[];
11+
};
12+
813
export function runBundler(
914
command: string,
1015
cwd: string,
@@ -25,6 +30,16 @@ export function readAllFiles(directory: string): Record<string, string> {
2530
let contents = readFileSync(fullPath, "utf-8");
2631
// We replace the current SHA with a placeholder to make snapshots deterministic
2732
contents = contents.replace(CURRENT_SHA, "CURRENT_SHA");
33+
34+
if (entry.endsWith(".map")) {
35+
const map = JSON.parse(contents) as SourceMap;
36+
map.sources = map.sources.map((c) => c.replace(/\\/g, "/"));
37+
map.sourcesContent = map.sourcesContent.map((c) => c.replace(/\r\n/g, "\n"));
38+
contents = JSON.stringify(map);
39+
} else {
40+
// Normalize Windows line endings for cross-platform snapshots
41+
contents = contents.replace(/\r\n/g, "\n");
42+
}
2843
files[entry] = contents;
2944
}
3045
}

0 commit comments

Comments
 (0)