fix: use bunx instead of npx to read Playwright versions under Bun - #5714
Open
mirao wants to merge 1 commit into
Open
fix: use bunx instead of npx to read Playwright versions under Bun#5714mirao wants to merge 1 commit into
mirao wants to merge 1 commit into
Conversation
`getPlaywrightBrowsers()` hardcoded `npx playwright install --dry-run`. A Bun-only environment has no `npx` on PATH, so `execSync` throws and the catch reports `Playwright not installed` on a working install. That is a false negative rather than a visible error, so it reads as a real misconfiguration. Pick the package runner from the runtime that is actually executing, via `process.versions.bun`, the same detection already used by `getRuntimeInfo()`. `bunx playwright install --dry-run` resolves the local `node_modules/.bin/playwright` and emits output identical to the `npx` form, so `parsePlaywrightBrowsers()` is unaffected and Node behaviour is unchanged. This is the only place CodeceptJS shells out to `npx`; every other occurrence under `lib/` is documentation text. It removes the need to symlink `npx` to `bun` in Bun images. Closes codeceptjs#5713 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Closes #5713
Problem
getPlaywrightBrowsers()inlib/command/info.jshardcoded the Node package runner:A Bun-only environment has no
npxonPATH, soexecSyncthrows and thecatchreportsPlaywright not installedon an install where Playwright and its browsers are present. It is a false negative rather than a visible error, so it reads as a genuine misconfiguration.Fix
Pick the package runner from the runtime that is actually executing rather than from whatever
PATHholds, viaprocess.versions.bun— the same detection already used bygetRuntimeInfo()in #5700.bunx playwright install --dry-runresolves the localnode_modules/.bin/playwrightand emits output identical to thenpxform, soparsePlaywrightBrowsers()needs no change and Node behaviour is unchanged.This is the only place CodeceptJS actually shells out to
npx; every other occurrence underlib/is documentation text. It removes the need to symlinknpxtobunin Bun images.Verification
codecept infowithnpxabsent fromPATHentirely, before and after:Node is byte-identical to before the change:
Unit tests cover both branches of the detection;
test/unit/command/*.jspasses.🤖 Generated with Claude Code