fix: require Node >=20 and use npm test --if-present in backend CI#980
Open
Anexus5919 wants to merge 1 commit into
Open
fix: require Node >=20 and use npm test --if-present in backend CI#980Anexus5919 wants to merge 1 commit into
Anexus5919 wants to merge 1 commit into
Conversation
The engines field claimed node >=18, but the toolchain cannot run there: vite 7 requires ^20.19 || >=22.12 and vitest 4 requires ^20 || ^22 || >=24, and CI only tests 20.x/22.x. Bump engines to >=20 so it matches reality. The backend test step used `if npm run | grep -q "test"`, which scrapes human-readable `npm run` output and matches any script containing "test". Replace it with `npm test --if-present`, which runs the test script only when it exists.
|
@Anexus5919 is attempting to deploy a commit to the somiljain2024-4175's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
|
@Somil450 @diksha78dev Kindly have a review on this pr. Thanks! |
1 similar comment
Contributor
Author
|
@Somil450 @diksha78dev Kindly have a review on this pr. Thanks! |
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.
📌 Related Issue
Fixes #898
Fixes #899
📝 Description
Two small build/CI metadata issues. The root
engines.nodeclaimed>=18.0.0, butvite@7requires^20.19 || >=22.12,vitest@4requires^20 || ^22 || >=24, and CI only tests 20.x/22.x, so Node 18 is neither supported nor tested. Separately, the backend CI step gated tests behindnpm run | grep -q "test", a fragile parse of human-readablenpm runoutput that also matches any script whose name merely contains "test".🔹 What has been changed?
engines.nodefrom>=18.0.0to>=20.0.0to match what the toolchain and CI actually require.if npm run | grep -q "test"; then npm test; fiwithnpm test --if-present, the built-in npm mechanism for "run the script only if it exists."🔹 Why are these changes needed?
>=18invites installs on a runtime the build tools reject. Bumping to>=20makes the requirement honest.npm test --if-presentis the standard, robust equivalent of the grep gate, with no dependence on the formatting ofnpm runoutput or accidental substring matches.🛠️ Type of Change
🧪 Testing
✅ Tests Performed
engines.nodeis>=20.0.0andpackage.jsonstill parses as valid JSON.npm test --if-presentand no longer grepsnpm runoutput.🔹 Note on automated tests
Metadata/CI-only changes; the dependency tree and lockfile are unaffected.
🌐 Browsers Tested
Not applicable (CI/package metadata).
📷 Screenshots / Demo (if applicable)
Not applicable.
📋 Checklist
💬 Additional Notes
Branched from
upstream/main; merges cleanly with the current base (which still declares>=18and the grep gate). This is the engines/backend-test pair; it does not change the install command (npm installvsnpm ci), which is a separate item.