diff --git a/test/init.test.ts b/test/init.test.ts index 688db44..577e788 100644 --- a/test/init.test.ts +++ b/test/init.test.ts @@ -3,8 +3,11 @@ import { mkdtemp } from "node:fs/promises"; import { existsSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; +import { fileURLToPath } from "node:url"; -const CLI = new URL("../src/cli.ts", import.meta.url).pathname; +// fileURLToPath (not .pathname) so the path is valid on Windows too — +// .pathname yields a leading-slash "/C:/..." that breaks Bun.spawn. +const CLI = fileURLToPath(new URL("../src/cli.ts", import.meta.url)); interface Run { stdout: string; diff --git a/test/roster.test.ts b/test/roster.test.ts index 687a7e7..b326cee 100644 --- a/test/roster.test.ts +++ b/test/roster.test.ts @@ -3,8 +3,11 @@ import { mkdtemp, mkdir, writeFile } from "node:fs/promises"; import { existsSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; +import { fileURLToPath } from "node:url"; -const CLI = new URL("../src/cli.ts", import.meta.url).pathname; +// fileURLToPath (not .pathname) so the path is valid on Windows too — +// .pathname yields a leading-slash "/C:/..." that breaks Bun.spawn. +const CLI = fileURLToPath(new URL("../src/cli.ts", import.meta.url)); interface Run { stdout: string; diff --git a/test/try.test.ts b/test/try.test.ts index eff831e..e619576 100644 --- a/test/try.test.ts +++ b/test/try.test.ts @@ -3,8 +3,11 @@ import { mkdtemp, mkdir, writeFile } from "node:fs/promises"; import { existsSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; +import { fileURLToPath } from "node:url"; -const CLI = new URL("../src/cli.ts", import.meta.url).pathname; +// fileURLToPath (not .pathname) so the path is valid on Windows too — +// .pathname yields a leading-slash "/C:/..." that breaks Bun.spawn. +const CLI = fileURLToPath(new URL("../src/cli.ts", import.meta.url)); interface Run { stdout: string;