@@ -8,10 +8,12 @@ const currentDir = import.meta.dirname;
88// Get project root (go up from tests/integration to project root)
99const projectRoot = path . resolve ( currentDir , "../.." ) ;
1010
11+ const esmPath = path . resolve ( projectRoot , "dist/esm/lib.js" ) ;
12+ const cjsPath = path . resolve ( projectRoot , "dist/cjs/lib.js" ) ;
13+
1114describe ( "Build Test" , ( ) => {
1215 it ( "should successfully require CommonJS module" , ( ) => {
1316 const require = createRequire ( __filename ) ;
14- const cjsPath = path . resolve ( projectRoot , "dist/cjs/lib.js" ) ;
1517
1618 const cjsModule = require ( cjsPath ) as Record < string , unknown > ;
1719
@@ -20,7 +22,7 @@ describe("Build Test", () => {
2022 } ) ;
2123
2224 it ( "should successfully import ESM module" , async ( ) => {
23- const esmModule = ( await import ( "../../dist/esm/lib.js" ) ) as Record < string , unknown > ;
25+ const esmModule = ( await import ( esmPath ) ) as Record < string , unknown > ;
2426
2527 expect ( esmModule ) . toBeDefined ( ) ;
2628 expect ( typeof esmModule ) . toBe ( "object" ) ;
@@ -29,11 +31,10 @@ describe("Build Test", () => {
2931 it ( "should have matching exports between CommonJS and ESM modules" , async ( ) => {
3032 // Import CommonJS module
3133 const require = createRequire ( __filename ) ;
32- const cjsPath = path . resolve ( __dirname , "../../dist/cjs/lib.js" ) ;
3334 const cjsModule = require ( cjsPath ) as Record < string , unknown > ;
3435
3536 // Import ESM module
36- const esmModule = ( await import ( "../../dist/esm/lib.js" ) ) as Record < string , unknown > ;
37+ const esmModule = ( await import ( esmPath ) ) as Record < string , unknown > ;
3738
3839 // Compare exports
3940 const cjsKeys = Object . keys ( cjsModule ) . sort ( ) ;
0 commit comments