Skip to content

fix: require Node >=20 and use npm test --if-present in backend CI#980

Open
Anexus5919 wants to merge 1 commit into
Somil450:mainfrom
Anexus5919:fix/build-engines-and-backend-test
Open

fix: require Node >=20 and use npm test --if-present in backend CI#980
Anexus5919 wants to merge 1 commit into
Somil450:mainfrom
Anexus5919:fix/build-engines-and-backend-test

Conversation

@Anexus5919

Copy link
Copy Markdown
Contributor

📌 Related Issue

Fixes #898
Fixes #899


📝 Description

Two small build/CI metadata issues. The root engines.node claimed >=18.0.0, but vite@7 requires ^20.19 || >=22.12, vitest@4 requires ^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 behind npm run | grep -q "test", a fragile parse of human-readable npm run output that also matches any script whose name merely contains "test".

🔹 What has been changed?

  • BLD-5: bumped engines.node from >=18.0.0 to >=20.0.0 to match what the toolchain and CI actually require.
  • BLD-6: replaced if npm run | grep -q "test"; then npm test; fi with npm test --if-present, the built-in npm mechanism for "run the script only if it exists."

🔹 Why are these changes needed?

  • Declaring >=18 invites installs on a runtime the build tools reject. Bumping to >=20 makes the requirement honest. npm test --if-present is the standard, robust equivalent of the grep gate, with no dependence on the formatting of npm run output or accidental substring matches.

🛠️ Type of Change

  • 🐛 Bug Fix
  • 🔧 Refactoring

🧪 Testing

✅ Tests Performed

  • Tested locally
  • Confirmed engines.node is >=20.0.0 and package.json still parses as valid JSON.
  • Confirmed the backend step uses npm test --if-present and no longer greps npm run output.

🔹 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

  • I have read the project's CONTRIBUTING guidelines
  • My code follows the project style guidelines
  • I have performed a self-review of my code
  • I have tested my changes locally
  • I have added/updated documentation where necessary (not applicable)
  • My changes do not introduce new warnings or errors
  • This PR is linked to an existing issue

💬 Additional Notes

Branched from upstream/main; merges cleanly with the current base (which still declares >=18 and the grep gate). This is the engines/backend-test pair; it does not change the install command (npm install vs npm ci), which is a separate item.

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.
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

@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.

@Anexus5919

Copy link
Copy Markdown
Contributor Author

@Somil450 @diksha78dev Kindly have a review on this pr. Thanks!

1 similar comment
@Anexus5919

Copy link
Copy Markdown
Contributor Author

@Somil450 @diksha78dev Kindly have a review on this pr. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant