Skip to content

Commit 515b7c5

Browse files
committed
fix: use arelative
1 parent 00a1b19 commit 515b7c5

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

tests/integration/build.test.ts

Lines changed: 3 additions & 8 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, pathToFileURL } from "url";
3+
import { fileURLToPath } from "url";
44
import { describe, it, expect } from "vitest";
55

66
const __filename = fileURLToPath(import.meta.url);
@@ -18,10 +18,7 @@ describe("Build Test", () => {
1818
});
1919

2020
it("should successfully import ESM module", async () => {
21-
const esmPath = path.resolve(__dirname, "../../dist/lib.js");
22-
const esmFileURL = pathToFileURL(esmPath).href;
23-
24-
const esmModule = (await import(esmFileURL)) as Record<string, unknown>;
21+
const esmModule = (await import("../../dist/lib.js")) as Record<string, unknown>;
2522

2623
expect(esmModule).toBeDefined();
2724
expect(typeof esmModule).toBe("object");
@@ -34,9 +31,7 @@ describe("Build Test", () => {
3431
const cjsModule = require(cjsPath) as Record<string, unknown>;
3532

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

4136
// Compare exports
4237
const cjsKeys = Object.keys(cjsModule).sort();

0 commit comments

Comments
 (0)