Skip to content

Nirali vitest lint fixes#5154

Open
Nirali164 wants to merge 2 commits intodevelopmentfrom
nirali-vitest-lint-fixes
Open

Nirali vitest lint fixes#5154
Nirali164 wants to merge 2 commits intodevelopmentfrom
nirali-vitest-lint-fixes

Conversation

@Nirali164
Copy link
Copy Markdown

Description

Resolved the JavaScript heap out-of-memory issue occurring during Vitest execution in CI for PR #4114. The root cause was identified as the AutoUpdate component creating intervals (setInterval) during test execution without proper cleanup, leading to memory leaks and eventual heap exhaustion.
Mocked the AutoUpdate component in the test environment to prevent interval creation. Additional improvements were made to stabilize test execution, including enabling fake timers and adjusting the test timeout. This ensures reliable linting and coverage enforcement as part of the Code Coverage Improvement Initiative.

Fixes # (bug list priority high) Vitest Memory Exhaustion in PR #4114
Implements # Code Coverage Improvement Initiative

Related PRS (if any):

This frontend PR is related to #4114 (linting and Vitest coverage enforcement).
No backend dependency required.

Main changes explained:

Mocked the AutoUpdate component in setupTests.js to prevent interval execution during tests
Updated vitest.config.js to enable fake timers for better control of async operations
Increased test timeout to avoid premature failures in CI
Updated CI workflow to include higher memory allocation for test execution
Ensured all tests, linting, and coverage scripts run successfully without memory issues

How to test:

Check out the current branch
Run npm install
run npm test
run npm run test: coverage
run npm run lint
Verify all tests pass without timeout or memory errors
optionally run CI=true npm run test: coverage to simulate CI behavior
push changes and verify GitHub Actions passes for PR #4114

Screenshots or videos of changes:

All test files passing locally (306 passed, 1 skipped)
Coverage run completed successfully without heap errors

Note:

Root cause was not related to threads, forks, or memory limits but due to uncontrolled intervals in tests
Mocking AutoUpdate eliminates memory leaks and stabilizes Vitest execution
Increasing memory and timeout are supporting improvements, not primary fixes
Future similar issues can be avoided by mocking components with timers or heavy async behavior

@Nirali164 Nirali164 requested a review from one-community April 15, 2026 17:32
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 15, 2026

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 9f90f1b
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/69dfcbbeb903e1000889828c
😎 Deploy Preview https://deploy-preview-5154--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Nirali164 Nirali164 requested a review from sundarmachani April 15, 2026 17:32
@sonarqubecloud
Copy link
Copy Markdown

@Nirali164 Nirali164 requested a review from DiyaWadhwani April 15, 2026 17:34
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.

1 participant