From 76f16b29db22abf5eeea3eb0b592d294ee9ee8c8 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Mon, 4 Nov 2024 13:13:50 -0800 Subject: [PATCH] chore: override host platform with env variable Allow to override host platform with an environment variable. This is for adventurous users that want to run Playwright on unsupported linux distributions. This way we do not need to hard code --- packages/playwright-core/src/utils/hostPlatform.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/playwright-core/src/utils/hostPlatform.ts b/packages/playwright-core/src/utils/hostPlatform.ts index 9664418e3d..7d81f39da3 100644 --- a/packages/playwright-core/src/utils/hostPlatform.ts +++ b/packages/playwright-core/src/utils/hostPlatform.ts @@ -35,6 +35,12 @@ export type HostPlatform = 'win64' | ''; function calculatePlatform(): { hostPlatform: HostPlatform, isOfficiallySupportedPlatform: boolean } { + if (process.env.PLAYWRIGHT_HOST_PLATFORM_OVERRIDE) { + return { + hostPlatform: process.env.PLAYWRIGHT_HOST_PLATFORM_OVERRIDE as HostPlatform, + isOfficiallySupportedPlatform: false + }; + } const platform = os.platform(); if (platform === 'darwin') { const ver = os.release().split('.').map((a: string) => parseInt(a, 10));