From fa75457cd3fcb1ca77a7c688cc76f78f6f46940e Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Thu, 30 Jul 2026 13:37:33 +0300 Subject: [PATCH] Fix CI --- app/utils/e2e.ts | 10 ++++++---- playwright.config.ts | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/utils/e2e.ts b/app/utils/e2e.ts index 50006f1e8..17e4fddc0 100644 --- a/app/utils/e2e.ts +++ b/app/utils/e2e.ts @@ -1,5 +1,7 @@ -// import.meta.env is undefined when Playwright bundles test code, -// so we need to check if it exists before accessing it +// import.meta.env is undefined when Playwright bundles test code, so we need to +// check if it exists before accessing it. There the flag comes from process.env +// instead (set by playwright.config.ts), as app modules run in the test process too. export const IS_E2E_TEST_RUN = - typeof import.meta.env !== "undefined" && - import.meta.env.VITE_E2E_TEST_RUN === "true"; + (typeof import.meta.env !== "undefined" && + import.meta.env.VITE_E2E_TEST_RUN === "true") || + (typeof process !== "undefined" && process.env.VITE_E2E_TEST_RUN === "true"); diff --git a/playwright.config.ts b/playwright.config.ts index cec1819df..e4068c4b4 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -2,6 +2,10 @@ import os from "node:os"; import type { PlaywrightTestConfig } from "@playwright/test"; import { devices } from "@playwright/test"; +// app modules are imported by the test process itself (factories), and they read +// this flag at import time. Workers inherit it from this process. +process.env.VITE_E2E_TEST_RUN = "true"; + const WORKER_COUNT = Number(process.env.E2E_WORKERS) || Math.min(8, Math.max(4, os.cpus().length - 2));