Skip to content

Commit 4e91a05

Browse files
author
sketch
committed
fix(benchmark): resolve file URLs with spaces on Windows
1 parent be1844c commit 4e91a05

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

scripts/benchmark/rebuild.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
*/
66

77
import { vmEnsureReady, vmBuildRtk } from "./lib/vm";
8+
import { fileURLToPath } from "node:url";
89

9-
const PROJECT_ROOT = new URL("../../", import.meta.url).pathname.replace(/\/$/, "");
10+
const PROJECT_ROOT = fileURLToPath(new URL("../..", import.meta.url));
1011

1112
await vmEnsureReady();
1213
const info = await vmBuildRtk(PROJECT_ROOT);

scripts/benchmark/run.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212
*/
1313

1414
import { $ } from "bun";
15+
import { resolve } from "node:path";
16+
import { fileURLToPath } from "node:url";
1517
import { vmEnsureReady, vmBuildRtk, vmExec, RTK_BIN } from "./lib/vm";
1618
import { testCmd, testSavings, testRewrite, skipTest, getCounts } from "./lib/test";
1719
import { saveReport } from "./lib/report";
1820

21+
const PROJECT_ROOT = fileURLToPath(new URL("../..", import.meta.url));
22+
1923
const args = process.argv.slice(2);
2024
const quick = args.includes("--quick");
2125
const phaseArg = args.includes("--phase")
@@ -28,9 +32,7 @@ if (args.includes("--phase") && phaseOnly === null) {
2832
}
2933
const reportPath = args.includes("--report")
3034
? args[args.indexOf("--report") + 1]
31-
: `${new URL("../../", import.meta.url).pathname.replace(/\/$/, "")}/benchmark-report.txt`;
32-
33-
const PROJECT_ROOT = new URL("../../", import.meta.url).pathname.replace(/\/$/, "");
35+
: resolve(PROJECT_ROOT, "benchmark-report.txt");
3436
const RTK = RTK_BIN;
3537

3638
function shouldRun(phase: number): boolean {

0 commit comments

Comments
 (0)