Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support big int in approximently #1606

Merged
merged 14 commits into from
Oct 9, 2024

Conversation

koddsson
Copy link
Member

@koddsson koddsson commented Feb 20, 2024

Added a new assertion property numeric which checks if given variable is of type Number or BigInt. Then used that new assertion to replace a is.a('number') check in the closeTo/approximately assertion.

Also replaced a Math.abs function call which doesn't support BigInt which all adds up to supporting BigInt in closeTo/approximately.

TODO

  • Write more tests for numeric assertion.

Follow up

  • Look for more places where we should support BigInt.

Fixes #1465

@koddsson koddsson force-pushed the support-big-int-in-approximently branch from 013e6a0 to 3587410 Compare October 6, 2024 17:20
@koddsson koddsson marked this pull request as ready for review October 6, 2024 17:24
@koddsson koddsson requested a review from a team as a code owner October 6, 2024 17:24
@koddsson koddsson enabled auto-merge (squash) October 6, 2024 17:25
@koddsson
Copy link
Member Author

koddsson commented Oct 8, 2024

@43081j; let me know what you think of 45f8825

lib/chai/core/assertions.js Outdated Show resolved Hide resolved
lib/chai/core/assertions.js Outdated Show resolved Hide resolved
@koddsson koddsson merged commit 1b17805 into chaijs:main Oct 9, 2024
5 checks passed
@koddsson koddsson deleted the support-big-int-in-approximently branch October 10, 2024 08: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.

assert.approximately does not work with bigints
2 participants