Skip to content

Commit aed8f80

Browse files
committed
fix: unit test cases
1 parent 6d247b7 commit aed8f80

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

packages/contentstack-auth/test/run.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { join, resolve } from "path";
1+
import { join, resolve, dirname } from "path";
22
import { existsSync, readdirSync, readFileSync } from "fs";
3+
import { fileURLToPath } from "url";
34
import filter from "lodash/filter.js";
45
import forEach from "lodash/forEach.js";
56
import isEmpty from "lodash/isEmpty.js";
@@ -10,7 +11,9 @@ import dotenv from 'dotenv';
1011
// NOTE init env variables
1112
dotenv.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

1518
const config = JSON.parse(readFileSync(join(__dirname, "config.json"), "utf-8"));
1619
const { 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

Comments
 (0)