Repository navigation
Tests: Preserve npm install policy in Vitest consumers - #86537
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: 0 B Total Size: 8.64 MB
|
2380d40 to
72253e9
Compare
|
Today's package deployment surfaced some more conflicts here (example failure). I think the tl;dr is that with the new minimum age restrictions, this "Vitest Consumers" check will fail for the first 24 hours after Gutenberg's NPM packages are published. The check is run on pull requests that change I'm not super familiar with what this test does (and unfortunately can't dive deep into this until tomorrow), but an AI-assisted assessment points to the behavior of |
* Tests: Preserve npm install policy in Vitest consumers * Tests: Enforce npm version for Vitest consumers * Tests: Simplify Vitest consumer install policy * CI: Read npm cache without repository runtime constraints * CI: Install npm without overwriting the bootstrap client * Tests: Preserve configured npm for the default consumer runtime --- Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: aduth <aduth@git.wordpress.org>
Follow-up to aduth's feedback on #82843.
What?
Preserve the repository's npm install protections in the isolated Vitest consumer checks, including
min-release-age.Why?
The consumer runner clears inherited npm configuration and installs outside the repository, so registry dependencies currently bypass its release-age policy.
How?
Copy the repository's
.npmrcandallowScriptspolicy into the consumer. Allow direct fixture tarballs withallow-file=root, while keeping transitive files, Git dependencies, and remote URL dependencies blocked. Preserve the consumer's existing hoisted layout and non-strict peer resolution for its ESLint 10 compatibility checks. Run consumer CI when either policy source changes.Testing Instructions
npm run test:unit:consumers -- --browserand confirm that all consumer checks pass.npm config get min-release-age strict-allow-scripts allow-file allow-git allow-remote. Confirm that the values are1,true,root,none, andnonerespectively.package.jsonhas the repository'sallowScriptsentries. Browser-provider and legacy Jest installs must retain the same policy.Use of AI Tools
OpenAI Codex implemented the change and ran verification.