From 8eba51aeb3d620b1392e924250a06018f321cc92 Mon Sep 17 00:00:00 2001 From: Raphael Arce Date: Mon, 14 Oct 2024 15:48:24 +0200 Subject: [PATCH] test: read env file with loadEnv Signed-off-by: Raphael Arce --- tests/e2e/playwright.config.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/e2e/playwright.config.ts b/tests/e2e/playwright.config.ts index be4ce03a1..5491d4239 100644 --- a/tests/e2e/playwright.config.ts +++ b/tests/e2e/playwright.config.ts @@ -1,4 +1,12 @@ import { defineConfig, devices } from "@playwright/test"; +import { loadEnv } from "vite"; + +/** + * in the CI pipeline, the env variables are provided by the CI, not the .env file + */ +if (!process.env.CI) { + process.env = { ...process.env, ...loadEnv("", process.cwd()) }; +} const port = process.env.VITE_PORT ? parseInt(process.env.VITE_PORT) : 5173;