ci: add lock file sync validation to prevent confusing npm install failures#6169
Open
Sekar-C-Mca wants to merge 1 commit intosugarlabs:masterfrom
Open
ci: add lock file sync validation to prevent confusing npm install failures#6169Sekar-C-Mca wants to merge 1 commit intosugarlabs:masterfrom
Sekar-C-Mca wants to merge 1 commit intosugarlabs:masterfrom
Conversation
…ilures Add pre-installation validation step in E2E, Lighthouse, and Jest workflows to detect when package-lock.json is out of sync with package.json. This provides clear, actionable error messages instead of cryptic npm ETARGET errors. Affected workflows: - pr-cypress-e2e.yml (E2E Tests) - lighthouse-ci.yml (Lighthouse Performance Audit) - pr-jest-tests.yml (Jest Unit Tests) When lock files are mismatched, workflows now fail with: - Clear error message explaining the problem - Step-by-step instructions to fix it locally - Guidance to run npm install and commit the lock file This improves developer experience by eliminating confusion about npm registry vs lock file sync issues.
Contributor
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Failed Tests: |
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
When developers update package.json but forget to run npm install locally before pushing, CI workflows fail with cryptic npm ETARGET errors that don't explain the real issue. Developers waste time debugging npm registry problems when the actual solution is simple: update the lock file.
Previously saw:
This misleading error wastes debugging time.
Solution
Add pre-installation validation to E2E, Lighthouse, and Jest workflows that detects when package-lock.json is out of sync with package.json. If detected, workflows fail immediately with a clear, actionable error message.
New behavior shows:
What's Changed
Added lock file sync validation step to:
Testing
Tested in fork with two scenarios:
Test 1 - With Lock File Mismatch (PR #4)
Test 2 - With Clean Lock Files (PR #5)
Impact
PR Category