Skip to content

Commit 00a1b19

Browse files
committed
fix: conver to proper file URLs
1 parent 70cd5c9 commit 00a1b19

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/integration/build.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createRequire } from "module";
22
import path from "path";
3-
import { fileURLToPath } from "url";
3+
import { fileURLToPath, pathToFileURL } from "url";
44
import { describe, it, expect } from "vitest";
55

66
const __filename = fileURLToPath(import.meta.url);
@@ -19,8 +19,9 @@ describe("Build Test", () => {
1919

2020
it("should successfully import ESM module", async () => {
2121
const esmPath = path.resolve(__dirname, "../../dist/lib.js");
22+
const esmFileURL = pathToFileURL(esmPath).href;
2223

23-
const esmModule = (await import(esmPath)) as Record<string, unknown>;
24+
const esmModule = (await import(esmFileURL)) as Record<string, unknown>;
2425

2526
expect(esmModule).toBeDefined();
2627
expect(typeof esmModule).toBe("object");
@@ -34,7 +35,8 @@ describe("Build Test", () => {
3435

3536
// Import ESM module
3637
const esmPath = path.resolve(__dirname, "../../dist/lib.js");
37-
const esmModule = (await import(esmPath)) as Record<string, unknown>;
38+
const esmFileURL = pathToFileURL(esmPath).href;
39+
const esmModule = (await import(esmFileURL)) as Record<string, unknown>;
3840

3941
// Compare exports
4042
const cjsKeys = Object.keys(cjsModule).sort();

0 commit comments

Comments
 (0)