We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Feature Request
Description: For each Number related matcher, support BigInt input values
For example this test should pass:
test('passes when value is a number', () => { expect(1n).toBeNumber() });
This matches Jest behaviour: jestjs/jest#8382
test('passes when value is a number', () => { expect(1n).toBeGreaterThan(0) });
Possible solution: Probably need to update each matcher on a case-by-case basis. Initial thoughts for each, might not cover everything:
toBeNumber
toBeNaN
isNaN
Number.isNaN
isFinite
Number
Number.isFinite(123n)
toBePositive
toBeNegative
toBeEven
2n
2
toBeOdd
toBeWithin
toBeInteger
Number.isInteger(123n)
The text was updated successfully, but these errors were encountered:
getBlockProduction
No branches or pull requests
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: