From b3972b640c5f7e7912d1affbf2be413ca7460cf2 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Thu, 8 Feb 2024 11:34:44 +0100 Subject: [PATCH] Fix the directory path --- scripts/vitest/setupFiles/dotenv.ts | 5 +++-- vitest.base.unit.config.ts | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/vitest/setupFiles/dotenv.ts b/scripts/vitest/setupFiles/dotenv.ts index 1dafa3b7f8b1..71364c7426bc 100644 --- a/scripts/vitest/setupFiles/dotenv.ts +++ b/scripts/vitest/setupFiles/dotenv.ts @@ -2,6 +2,7 @@ import path from "node:path"; // It's a dev dependency // eslint-disable-next-line import/no-extraneous-dependencies import {config} from "dotenv"; -const currentDir = new URL(".", import.meta.url).pathname; +// eslint-disable-next-line @typescript-eslint/naming-convention +const __dirname = new URL(".", import.meta.url).pathname; -config({path: path.join(currentDir, "../../../.env.test"), debug: true}); +config({path: path.join(__dirname, "../../../.env.test")}); diff --git a/vitest.base.unit.config.ts b/vitest.base.unit.config.ts index c442c9f01f61..293b29214239 100644 --- a/vitest.base.unit.config.ts +++ b/vitest.base.unit.config.ts @@ -1,6 +1,6 @@ import path from "node:path"; import {defineConfig} from "vitest/config"; -const currentDir = new URL(".", import.meta.url).pathname; +const __dirname = new URL(".", import.meta.url).pathname; export default defineConfig({ test: { @@ -15,8 +15,8 @@ export default defineConfig({ "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*", ], setupFiles: [ - path.join(currentDir, "./scripts/vitest/setupFiles/customMatchers.ts"), - path.join(currentDir, "./scripts/vitest/setupFiles/dotenv.ts"), + path.join(__dirname, "./scripts/vitest/setupFiles/customMatchers.ts"), + path.join(__dirname, "./scripts/vitest/setupFiles/dotenv.ts"), ], reporters: ["default", "hanging-process"], coverage: {