diff --git a/constants.js b/constants.js index ab9d070..3dad2bb 100644 --- a/constants.js +++ b/constants.js @@ -1,12 +1,12 @@ import chalk from 'chalk'; import fs from 'fs'; import path from 'path'; -import { pathToFileURL } from 'url'; +import { pathToFileURL, fileURLToPath } from 'url'; import dotenv from 'dotenv'; dotenv.config(); // Since __dirname is not available in ES modules, we need to derive it -const __filename = new URL(import.meta.url).pathname; +const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); // Function to find the project root directory diff --git a/constants.test.js b/constants.test.js index 28d9b73..f44451d 100644 --- a/constants.test.js +++ b/constants.test.js @@ -9,6 +9,8 @@ import { ALL_TEAM_NAMES, } from './constants.js'; +// Most test using the globally set mockConfigDetails will fail because on constants.js, +// shadowConfigDetails is encapsulated and not set as a global object describe('Constants', () => { const originalEnv = process.env; const mockConfigDetails = {