Skip to content

sundar_fix_unit_test_ForcePasswordUpdate.jsx#3508

Merged
one-community merged 3 commits into
developmentfrom
sundar_fix_CI_tests
May 12, 2025
Merged

sundar_fix_unit_test_ForcePasswordUpdate.jsx#3508
one-community merged 3 commits into
developmentfrom
sundar_fix_CI_tests

Conversation

@sundarmachani
Copy link
Copy Markdown
Contributor

@sundarmachani sundarmachani commented May 10, 2025

Description

This PR addresses two separate issues in our frontend workflow:

  1. Jest/jsdom failures in ForcePasswordUpdate tests:
  • React-Toastify was attempting to unmount toasts in an environment without a , causing “node to be removed” errors.
  • An unknown darkMode prop was being passed into native elements, triggering React warnings.
  1. Netlify out-of-memory build errors:
  • Create-React-App’s production build was running out of V8 heap while generating source maps and running in CI mode, causing JavaScript heap OOM on Netlify.

Related PRS (if any):

None

Main changes explained:

  • Test-env stub for React-Toastify

Under NODE_ENV==='test', override toast.success/toast.error so they synchronously append a simple

and immediately invoke any onClose callback. Eliminates timers/animations in Jest and prevents jsdom “remove child” errors.

  • Strip darkMode before rendering

Override renderInput() in ForcePasswordUpdate to destructure out darkMode and pass only the remaining props to the base form helper, removing the unknown-prop warning.

  • Update package.json build script

Use cross-env GENERATE_SOURCEMAP=false CI=false react-scripts build to:

  • Disable source-map generation (saves 300–500 MB of heap)
  • Turn off CRA’s strict CI mode
    This change prevents Node’s default ~1.4 GB heap from being exceeded during Webpack/Babel bundling on Netlify.

How to test:

  1. check into current branch
  2. do npm install and ... to run this PR locally
  3. Run npm run test, all the test cases should pass.

Screenshots

Screenshot 2025-05-09 at 9 04 46 PM Screenshot 2025-05-09 at 9 04 23 PM

Note:

  • No new dependencies were added.

  • Production behavior in browsers and on Netlify (without GENERATE_SOURCEMAP=false) remains unchanged.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 10, 2025

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 5ce13ad
🔍 Latest deploy log https://app.netlify.com/sites/highestgoodnetwork-dev/deploys/681eb1d6ef6f5100086df7fa
😎 Deploy Preview https://deploy-preview-3508--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 site configuration.

Copy link
Copy Markdown
Contributor

@abdel-lall abdel-lall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Screenshot 2025-05-11 010557

@one-community
Copy link
Copy Markdown
Member

Thank you all, merging!

@one-community one-community merged commit d315a09 into development May 12, 2025
6 checks passed
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.

3 participants