Repository navigation
chore: install the Playwright browsers before the browser tests - #327
Merged
Merged
Conversation
|
Size Change: 0 B Total Size: 12.7 kB ℹ️ View Unchanged
|
Deploying chartjs-plugin-gradient with
|
| Latest commit: |
683b980
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7a5a0713.chartjs-plugin-gradient.pages.dev |
| Branch Preview URL: | https://chore-install-test-browsers.chartjs-plugin-gradient.pages.dev |
Every Playwright release pins its own browser builds, so after any Playwright bump `npm test` fails with "browserType.launch: Executable doesn't exist" until `npx playwright install` has been run by hand. The pre-commit hook runs `npm test`, and the `prepare` script enables the hook, so a fresh clone could not commit either. Every npm script that runs a Vitest browser-mode config now has a `pre` script that runs `playwright install` for exactly the browsers that script uses: chromium and firefox for `test:fixture` and `dev` (vitest.browser.config.ts), chromium for `test:integration:min-bundle` (vitest.integration.config.ts), and chromium for `fixtures:update`, which runs the fixture suite in its chromium-only mode. When the right builds are present the command only checks and exits (about 0.5 s); otherwise it downloads them. The install is not tied to `postinstall` or `prepare`: CI installs with `--ignore-scripts` and installs its browsers explicitly, and a lifecycle install hook would download browsers for people who never run the tests. Co-Authored-By: Claude Fable 5.2 <[email protected]>
kurkle
force-pushed
the
chore/install-test-browsers
branch
from
November 19, 2026 16:45
82d96e4 to
683b980
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Problem
Every Playwright release pins its own browser builds. After any Playwright bump,
npm testfails locally withbrowserType.launch: Executable doesn't existuntilnpx playwright installhas been run by hand. The pre-commit hook runsnpm test, and thepreparescript enables the hook, so a fresh clone cannot commit.Change
package.jsongets fourprescripts, one for every script that runs a Vitest browser-mode config, each installing exactly the browsers that script uses:pretest:fixtureandpredev:playwright install chromium firefox(vitest.browser.config.ts)pretest:integration:min-bundle:playwright install chromium(vitest.integration.config.ts)prefixtures:update:playwright install chromium(fixtures:updateruns the fixture suite in its chromium-only mode)When the right builds are present the command only checks and exits (about 0.5 s); otherwise it downloads them. It is not tied to
postinstall/prepare: CI installs with--ignore-scriptsand installs its browsers explicitly, and an install hook would download browsers for people who never run the tests. The hook, workflows and Vitest configs are unchanged.chore:so no release is triggered.Verification
With
PLAYWRIGHT_BROWSERS_PATHpointing at an empty directory:npm run test:fixtureonmainfails withExecutable doesn't exist; with this change it downloads chromium and firefox and passes (96 tests), andnpm run test:integration:min-bundlethen passes (5 tests). Build, lint, typecheck,npm testand the pre-commit hook pass.🤖 Generated with Claude Code