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
This commit is contained in:
Yury Semikhatsky 2024-11-04 13:13:50 -08:00
parent ab22f81922
commit 76f16b29db

View file

@ -35,6 +35,12 @@ export type HostPlatform = 'win64' |
'<unknown>';
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));