You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some, not all, of our projects have a dependency on Playwright. Playwright, by default, downloads and installs a whole browser, so I'd like to avoid doing so if possible!
I can defer this during the initial pnpm install with PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1, and run it later with playwright install --with-deps.
My first approach was to write a custom script that analyzed turbo run --dry=json output to determine if any tasks that required Playwright were about to run, and only if so, install Playwright. This got the job done, but it seemed excessively complex.
My second attempt was to define a //#playwright:install global task that relevant tasks could depend on. That way, Turborepo could parallelize it with other tasks that didn't have that dependency! However, this task can't be cached, because it sets up the local environment (in particular, the --with-deps flag will install some binary dependencies to the operating system).
So what I found is that //#playwright:install always ran, even if the only tasks that needed it could be resolved from the cache!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Some, not all, of our projects have a dependency on Playwright. Playwright, by default, downloads and installs a whole browser, so I'd like to avoid doing so if possible!
I can defer this during the initial
pnpm install
withPLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
, and run it later withplaywright install --with-deps
.My first approach was to write a custom script that analyzed
turbo run --dry=json
output to determine if any tasks that required Playwright were about to run, and only if so, install Playwright. This got the job done, but it seemed excessively complex.My second attempt was to define a
//#playwright:install
global task that relevant tasks could depend on. That way, Turborepo could parallelize it with other tasks that didn't have that dependency! However, this task can't be cached, because it sets up the local environment (in particular, the--with-deps
flag will install some binary dependencies to the operating system).So what I found is that
//#playwright:install
always ran, even if the only tasks that needed it could be resolved from the cache!Is there a better way to do this?
Beta Was this translation helpful? Give feedback.
All reactions