Skip to content

Conversation

@bheemreddy-samsara
Copy link
Contributor

Summary

  • Avoid emitting a BigInt literal in Assertion.closeTo, which causes Hermes (React Native) to fail bundle
    evaluation with No identifiers allowed directly after numeric literal.
  • Use regular number math for abs so the code path stays compatible with engines lacking BigInt literal parsing.

Context

  • RN 0.79.x, Hermes on Android.
  • Chai 5.3.3.
  • Hermes rejects the 0n literal during bundle load; app crashes before tests run.

Change

  • lib/chai/core/assertions.js: change const abs = (x) => (x < 0n ? -x : x); to const abs = (x < 0 ? -x : x);
    and document the rationale.

Testing

  • Verified on a React Native app with Hermes: harness tests now load and pass; the prior syntax error is gone.

@bheemreddy-samsara bheemreddy-samsara requested a review from a team as a code owner November 20, 2025 16:05
@bheemreddy-samsara
Copy link
Contributor Author

@snewcomer can i get a review on this ?

@43081j 43081j merged commit 243bf86 into chaijs:main Nov 21, 2025
6 checks passed
@bheemreddy-samsara bheemreddy-samsara deleted the fix/hermes-bigint-closeTo branch November 21, 2025 23:43
@bheemreddy-samsara
Copy link
Contributor Author

bheemreddy-samsara commented Nov 21, 2025

@43081j Quick question on when will this be released ?

@43081j
Copy link
Contributor

43081j commented Nov 22, 2025

ill aim to release it in the next couple of days 👍

@bheemreddy-samsara
Copy link
Contributor Author

@43081j do you have plan for the release before the new year ?

@43081j
Copy link
Contributor

43081j commented Dec 22, 2025

should be released in 6.2.2 👍

let me know if all is well

@bheemreddy-samsara
Copy link
Contributor Author

@43081j thanks a ton :-) Happy Holidays and Merry Christmas

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.

2 participants