Skip to content

feat: add explicit cypress install step after dependency install#1799

Open
mschile wants to merge 1 commit into
masterfrom
claude/nostalgic-curran-7c5011
Open

feat: add explicit cypress install step after dependency install#1799
mschile wants to merge 1 commit into
masterfrom
claude/nostalgic-curran-7c5011

Conversation

@mschile

@mschile mschile commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

What

Adds an explicit, package-manager-aware cypress install step that runs after dependency install in index.js.

  • npmnpx cypress install
  • yarnyarn cypress install
  • pnpmpnpm cypress install

The package manager is detected by lockfile (the same detection already used for dependency install). The step runs on every install path (including a custom install-command), is skipped when install: false, and respects CYPRESS_INSTALL_BINARY=0.

Why

Package managers may no longer run a dependency's postinstall script by default — pnpm and Yarn Berry (≥4.14) already block them, and npm 12 will via RFC #868. Cypress downloads its binary via a postinstall script, so:

  • Cache hit (steady-state CI): binary restored from ~/.cache/Cypress, unaffected.
  • Cache miss / first run / cache-key change: the binary was never downloaded and cypress verify failed.

Running cypress install explicitly keeps the binary available on a cold cache regardless of package manager. It's a no-op when the binary is already present, so it's safe to run unconditionally.

Notes for reviewers

  • Wired into installMaybe() between install() and listCypressBinaries().
  • No core.exportVariable('CYPRESS_CACHE_FOLDER', ...) is needed in the new function — install() always runs immediately before it and already exports it for the process.
  • dist/index.js rebuilt via the pre-commit hook (ncc build).
  • No unit tests in this repo; behavior is exercised via the example workflows.

Closes #1798

References

🤖 Generated with Claude Code


Note

Low Risk
CI install-path change only; respects existing skip flags and is a no-op when the binary is already present.

Overview
Adds installCypressBinary(), which runs an explicit package-manager-aware cypress install after dependency install so the Cypress binary is downloaded when postinstall is skipped (pnpm, Yarn Berry, upcoming npm behavior). It uses the same lockfile detection as install: yarnyarn cypress install, pnpmpnpm cypress install, otherwise npxnpx cypress install. It no-ops when CYPRESS_INSTALL_BINARY=0.

installMaybe() now calls this step between install() and listCypressBinaries(); verify/cache behavior is unchanged. dist/index.js is rebuilt to match index.js.

Reviewed by Cursor Bugbot for commit bd9852b. Bugbot is set up for automated code reviews on this repo. Configure here.

Package managers may no longer run a dependency's postinstall script by
default (pnpm and Yarn Berry already block them, npm 12 will via RFC #868).
Cypress downloads its binary via postinstall, so on a cold cache the binary
was not downloaded and `cypress verify` failed.

Run a package-manager-aware `cypress install` after dependencies are
installed (npx/yarn/pnpm), keeping the binary available regardless of
package manager. The step is a no-op when the binary is already present and
is skipped when CYPRESS_INSTALL_BINARY=0.

Closes #1798

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add explicit cypress install step for postinstall script handling (npm RFC #868)

1 participant