Skip to content

Commit 09ecb24

Browse files
committed
Fix Windows
1 parent 22ade90 commit 09ecb24

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

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/rolldown/rolldown.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import { join } from "node:path";
44
import { rmSync, mkdtempSync } from "node:fs";
55
import { tmpdir } from "node:os";
66
import { randomUUID } from "node:crypto";
7+
import { fileURLToPath } from "node:url";
78

8-
const __dirname = new URL(".", import.meta.url).pathname;
9+
const __dirname = fileURLToPath(new URL(".", import.meta.url));
910

1011
const tempDirs: string[] = [];
1112

@@ -25,7 +26,7 @@ function runRolldown(
2526
config: string,
2627
env: Record<string, string | undefined> = { ...process.env }
2728
): void {
28-
runBundler(`rolldown --config ${config}`, { cwd: __dirname }, { ...process.env, ...env });
29+
runBundler(`rolldown --config ${config}`, __dirname, { ...process.env, ...env });
2930
}
3031

3132
describe("rolldown", () => {

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@ 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,
10-
options: { cwd: string },
15+
cwd: string,
1116
env: Record<string, string | undefined>
1217
): void {
13-
execSync(command, { cwd: options.cwd, stdio: DEBUG ? "inherit" : "ignore", env });
18+
execSync(command, { cwd, stdio: DEBUG ? "inherit" : "ignore", env });
1419
}
1520

1621
export function readAllFiles(directory: string): Record<string, 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
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig } from "vitest/config";
2+
3+
export default defineConfig({
4+
test: {
5+
environment: "node",
6+
// Our tests already spawn separate processes for the bundlers
7+
pool: "threads",
8+
disableConsoleIntercept: true,
9+
silent: false,
10+
},
11+
});

0 commit comments

Comments
 (0)