-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
BigInt support for Number functions #591
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature Request
Description: For each Number related matcher, support BigInt input values
For example this test should pass:
This matches Jest behaviour: jestjs/jest#8382
Possible solution: Probably need to update each matcher on a case-by-case basis. Initial thoughts for each, might not cover everything:
toBeNumber
is just a case of updating the typeof checktoBeNaN
should be able to be fixed by changing fromisNaN
toNumber.isNaN
which supports bigint correctlyisFinite
will probably need to cast its input toNumber
sinceNumber.isFinite(123n)
is false for some reasontoBePositive
usesisNaN
, probably just needs updating toNumber.isNaN
🤞toBeNegative
seems to work (should add tests though to make sure it keeps working!)toBeEven
probably needs to check the type, and use2n
instead of2
for bigint (can't do bigint % number, or vice versa)toBeOdd
same astoBeEven
toBeWithin
seems to worktoBeInteger
will probably need to cast its input toNumber
sinceNumber.isInteger(123n)
is false for some reasonThe text was updated successfully, but these errors were encountered: