fix(registry): evaluate defaultCacheDirectory lazily#41942
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| let _defaultCacheDirectory: string | undefined; | ||
|
|
||
| export const defaultRegistryDirectory = path.join(defaultCacheDirectory, 'ms-playwright'); | ||
| // Evaluated lazily so an explicit PLAYWRIGHT_BROWSERS_PATH lets Playwright run on |
There was a problem hiding this comment.
Please drop all these useless comments!
pavelfeldman
left a comment
There was a problem hiding this comment.
Let's strip the useless comments.
`defaultCacheDirectory` used to be computed inside the `PLAYWRIGHT_BROWSERS_PATH` branch of `registryDirectory`, so setting that variable skipped the platform check a later refactor hoisted it into an eagerly evaluated module constant, so it now throws `Unsupported platform: <platform>` at import, before `registryDirectory` consults `PLAYWRIGHT_BROWSERS_PATH` this regressed setups that point `PLAYWRIGHT_BROWSERS_PATH` at their own browsers on platforms without a default cache directory, such as Android/Termux evaluate `defaultCacheDirectory`, `defaultRegistryDirectory`, and `baseDaemonDir` lazily so an explicit `PLAYWRIGHT_BROWSERS_PATH` is honored before any default cache directory is computed `registryDirectory` still throws eagerly when no override is set, since there is nowhere to place browsers
Test results for "tests 1"5 flaky50308 passed, 1190 skipped Merge workflow run. |
Test results for "MCP"1 failed 7794 passed, 1266 skipped Merge workflow run. |
|
Hi, I'm the Playwright bot and I took a first look at the CI failures here. 🟢 The one failure is a pre-existing flake — the PR looks clear
DetailsPre-existing flake / infra
The diff is confined to browser cache-directory resolution — Triaged by the Playwright bot - agent run |
defaultCacheDirectoryused to be computed inside thePLAYWRIGHT_BROWSERS_PATHbranch ofregistryDirectory, so setting that variable skipped the platform check#39423 hoisted it into an eagerly evaluated module constant, so it now throws
Unsupported platform: <platform>at import, beforeregistryDirectoryconsultsPLAYWRIGHT_BROWSERS_PATHthis regressed setups that point
PLAYWRIGHT_BROWSERS_PATHat their own browsers on platforms without a default cache directory, such as Android/Termuxevaluate
defaultCacheDirectory,defaultRegistryDirectory, andbaseDaemonDirlazily so an explicitPLAYWRIGHT_BROWSERS_PATHis honored before any default cache directory is computedregistryDirectorystill throws eagerly when no override is set, since there is nowhere to place browsersfixes #41852