1- import { join , resolve } from "path" ;
1+ import { join , resolve , dirname } from "path" ;
22import { existsSync , readdirSync , readFileSync } from "fs" ;
3+ import { fileURLToPath } from "url" ;
34import filter from "lodash/filter.js" ;
45import forEach from "lodash/forEach.js" ;
56import isEmpty from "lodash/isEmpty.js" ;
@@ -10,7 +11,9 @@ import dotenv from 'dotenv';
1011// NOTE init env variables
1112dotenv . config ( ) ;
1213
13- // __filename and __dirname are already available in CommonJS mode
14+ // ES module equivalent of __dirname
15+ const __filename = fileURLToPath ( import . meta. url ) ;
16+ const __dirname = dirname ( __filename ) ;
1417
1518const config = JSON . parse ( readFileSync ( join ( __dirname , "config.json" ) , "utf-8" ) ) ;
1619const { IS_TS , UNIT_EXECUTION_ORDER , INTEGRATION_EXECUTION_ORDER } = config ;
@@ -74,4 +77,4 @@ if (includes(args, '--integration-test')) {
7477 run ( INTEGRATION_EXECUTION_ORDER ) ;
7578} else if ( includes ( args , '--unit-test' ) ) {
7679 // run(UNIT_EXECUTION_ORDER, false);
77- }
80+ }
0 commit comments