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

feat: BigInt Support #8382

Merged
merged 52 commits into from Sep 6, 2019
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
1941be0
feat(jest-get-type) include bigint
JoshRosenstein Apr 25, 2019
d39a157
(jest-matcher-utils) add ensureActualIsNumberOrBigInit
JoshRosenstein Apr 26, 2019
16a2312
(expect) add biginit support
JoshRosenstein Apr 26, 2019
3ccbce4
Revert gettype to ifelse
JoshRosenstein Apr 26, 2019
2995d69
Add tests mixing numbers and bigint
JoshRosenstein Apr 26, 2019
ff21d21
bigDumbTypo
JoshRosenstein Apr 26, 2019
4128975
babel-plugin-jest-hoist add to whitelist
JoshRosenstein Apr 26, 2019
2488c34
Wrap BigInt Tests with guard
JoshRosenstein Apr 26, 2019
9c68a16
temp fix test suite must contain at least one test
JoshRosenstein Apr 26, 2019
3e33530
remove MatchingSnapshot tests due to unsupported env having obsoletes
JoshRosenstein Apr 26, 2019
50b3bb4
remove unnecessary bigint check in equals
JoshRosenstein Apr 29, 2019
cde6327
Remove ensure*NumbersOrBigInt, include BigInt in originals, add `or b…
JoshRosenstein Apr 29, 2019
8e0656a
Update snapshots with new error message `number or bigint`
JoshRosenstein Apr 29, 2019
d1e1b88
add bigint support to toBeCloseTo, replace ensureNumbersOrBigInt to e…
JoshRosenstein Apr 29, 2019
1a2ff60
tests(expect) remove temp_test, add bigint tests to matchers.test
JoshRosenstein Apr 29, 2019
0c594cf
tests(jest-matcher-utils) remove temp_tests, add bigint tests to inde…
JoshRosenstein Apr 29, 2019
b122b02
Update CHANGELOG.md
JoshRosenstein Apr 29, 2019
c640ec3
Merge branch 'master' into BigInt
JoshRosenstein Apr 29, 2019
f5cec2a
Update CHANGELOG.md
JoshRosenstein Apr 30, 2019
5bf3acc
(babel-preset-jest)-add @babel/plugin-syntax-bigint
JoshRosenstein Apr 30, 2019
be5cbb6
Add tests for bigint syntax
JoshRosenstein Apr 30, 2019
8c1d55c
Update CHANGELOG.md
JoshRosenstein Apr 30, 2019
3459c44
:rage2: :abc:
JoshRosenstein Apr 30, 2019
592d6f3
Checking if node6 breaks with lookup
JoshRosenstein Apr 30, 2019
c2c771a
Revert "Checking if node6 breaks with lookup"
JoshRosenstein Apr 30, 2019
fb6655d
Revert "Add tests for bigint syntax"
JoshRosenstein Apr 30, 2019
0646729
Update CHANGELOG.md
pedrottimark Apr 30, 2019
9390440
Remove Default Precision Value and update error msg via code review
JoshRosenstein May 1, 2019
52d110d
Replace ensureExpectedIsNumber with ensureExpectedIsNonNegativeIntege…
JoshRosenstein May 1, 2019
5430e1a
Update Matchers interface
JoshRosenstein May 1, 2019
42e4e89
Revert Bigint Support for 'toBeCloseTo'
JoshRosenstein May 1, 2019
67d1ad8
Update CHANGELOG.md
JoshRosenstein May 1, 2019
aba6474
pedrottimark's CR fixes in tests :eyes: :dart:
JoshRosenstein May 1, 2019
b4884f5
Merge branch 'master' into BigInt
JoshRosenstein May 5, 2019
c4aea47
Merge remote-tracking branch 'upstream/master' into BigInt
JoshRosenstein May 13, 2019
f2a5745
Update CHANGELOG.md
JoshRosenstein May 13, 2019
99642be
Merge branch 'master' into BigInt
thymikee Jun 14, 2019
f0d73f8
Merge commit '1749aeab92e33fe1ae65196c75aebd2d1f366ab2' into BigInt
SimenB Sep 1, 2019
0bdddfd
Merge commit 'b64d35d127ba41a8233ded35a52a9a70981d9d53' into BigInt
SimenB Sep 1, 2019
d22ed48
Merge commit 'b2c9fe3726d81c7ea6d71115352f177afd6210ba' into BigInt
SimenB Sep 1, 2019
46d64de
Merge commit '798891208e752e084c7935e2e52e0f765a758c1e' into BigInt
SimenB Sep 1, 2019
1d9e41a
Merge commit 'a1e30075ca60fb720ae1ba9a66ba1e4837c67428' into BigInt
SimenB Sep 1, 2019
e8d9411
Merge commit '88ccda0910c83b92bcb5671dc9b0de94e5250054' into BigInt
SimenB Sep 1, 2019
615b2c4
Merge branch 'master' into BigInt
SimenB Sep 1, 2019
6164740
move changelog entries
SimenB Sep 1, 2019
ad3c832
fix changelog formatting
SimenB Sep 1, 2019
c30ae9c
Delete unnecessary disable of eslint rules
pedrottimark Sep 3, 2019
de4d01c
Update ExpectAPI.md
pedrottimark Sep 3, 2019
0e2ef7d
Update CHANGELOG.md
pedrottimark Sep 3, 2019
007919d
Edit ExpectAPI.md
pedrottimark Sep 4, 2019
2d026e9
Merge branch 'master' into BigInt
SimenB Sep 6, 2019
89b1538
Merge branch 'master' into BigInt
SimenB Sep 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintrc.js
Expand Up @@ -26,7 +26,11 @@ module.exports = {
],
'import/order': 'error',
'no-dupe-class-members': 'off',
// ts handles this check for us, also eslint does not include Bigint
'no-undef': 'off',
'no-unused-vars': 'off',
// ts handles this check for us, also eslint does not include bigint
'valid-typeof': 'off',
Copy link
Contributor

Choose a reason for hiding this comment

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

valid-typeof includes bigint starting in 6.0.0-rc.0

Copy link
Member

Choose a reason for hiding this comment

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

yeah, we can revert the eslint changes if they no longer cause issues. Makes this PR a bit bigger than it needs to be. you wanna do that?

},
},
// to make it more suitable for running on code examples in docs/ folder
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,11 @@
- `[expect]` Improve report when matcher fails, part 17 ([#8349](https://github.com/facebook/jest/pull/8349))
- `[expect]` Improve report when matcher fails, part 18 ([#8356](https://github.com/facebook/jest/pull/8356))
- `[expect]` Improve report when matcher fails, part 19 ([#8367](https://github.com/facebook/jest/pull/8367))
- `[expect]`- Add BigInt Support to `toBeGreaterThan`, `toBeGreaterThanOrEqual`, `toBeLessThan` `toBeLessThanOrEqual` and `toBeCloseTo` ([#8382](https://github.com/facebook/jest/pull/8382))
- `[jest-get-type]`- Add BigInt Support. ([#8382](https://github.com/facebook/jest/pull/8382))
- `[jest-matcher-utils]`- Add BigInt Support to `ensureNumbers` `ensureActualIsNumber`, `ensureExpectedIsNumber` ([#8382](https://github.com/facebook/jest/pull/8382))
- `[babel-plugin-jest-hoist]`- Add BigInt to `WHITELISTED_IDENTIFIERS`([#8382](https://github.com/facebook/jest/pull/8382))
- `[babel-preset-jest]`- Add @babel/plugin-syntax-bigint`([#8382](https://github.com/facebook/jest/pull/8382))

### Fixes

Expand All @@ -31,6 +36,7 @@
- `[@jest/reporters]` Migrate away from `istanbul-api` ([#8294](https://github.com/facebook/jest/pull/8294))
- `[*]` Delete obsolete emails tag from header comment in test files ([#8377](https://github.com/facebook/jest/pull/8377))
- `[expect]` optimize compare nodes ([#8368](https://github.com/facebook/jest/pull/8368))
- `[eslintrc]` Disable valid-typeof, no-undef for ts overrides ([#8382](https://github.com/facebook/jest/pull/8382))

### Performance

Expand Down
1 change: 1 addition & 0 deletions packages/babel-plugin-jest-hoist/src/index.ts
Expand Up @@ -25,6 +25,7 @@ const WHITELISTED_IDENTIFIERS: Set<string> = new Set([
'Array',
'ArrayBuffer',
'Boolean',
'BigInt',
'DataView',
'Date',
'Error',
Expand Down
1 change: 1 addition & 0 deletions packages/babel-preset-jest/index.js
Expand Up @@ -9,5 +9,6 @@ module.exports = () => ({
plugins: [
require.resolve('babel-plugin-jest-hoist'),
require.resolve('@babel/plugin-syntax-object-rest-spread'),
require.resolve('@babel/plugin-syntax-bigint'),
],
});
1 change: 1 addition & 0 deletions packages/babel-preset-jest/package.json
Expand Up @@ -9,6 +9,7 @@
"license": "MIT",
"main": "index.js",
"dependencies": {
"@babel/plugin-syntax-bigint": "^7.0.0",
JoshRosenstein marked this conversation as resolved.
Show resolved Hide resolved
"@babel/plugin-syntax-object-rest-spread": "^7.0.0",
"babel-plugin-jest-hoist": "^24.6.0"
},
Expand Down
Expand Up @@ -630,7 +630,7 @@ Received difference: <red>0.005000099999999952</>"
exports[`.toBeCloseTo() throws: Matcher error promise empty isNot false received 1`] = `
"<dim>expect(</><red>received</><dim>).</>toBeCloseTo<dim>(</><green>expected</><dim>, </><green>precision</><dim>)</>

<bold>Matcher error</>: <red>received</> value must be a number
<bold>Matcher error</>: <red>received</> value must be a number or bigint

Received has type: string
Received has value: <red>\\"\\"</>"
Expand All @@ -639,15 +639,15 @@ Received has value: <red>\\"\\"</>"
exports[`.toBeCloseTo() throws: Matcher error promise empty isNot true expected 1`] = `
"<dim>expect(</><red>received</><dim>).</>not<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>)</>

<bold>Matcher error</>: <green>expected</> value must be a number
<bold>Matcher error</>: <green>expected</> value must be a number or bigint

Expected has value: <green>undefined</>"
`;

exports[`.toBeCloseTo() throws: Matcher error promise rejects isNot false expected 1`] = `
"<dim>expect(</><red>received</><dim>).</>rejects<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>)</>

<bold>Matcher error</>: <green>expected</> value must be a number
<bold>Matcher error</>: <green>expected</> value must be a number or bigint

Expected has type: string
Expected has value: <green>\\"0\\"</>"
Expand All @@ -656,7 +656,7 @@ Expected has value: <green>\\"0\\"</>"
exports[`.toBeCloseTo() throws: Matcher error promise rejects isNot true received 1`] = `
"<dim>expect(</><red>received</><dim>).</>rejects<dim>.</>not<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>)</>

<bold>Matcher error</>: <red>received</> value must be a number
<bold>Matcher error</>: <red>received</> value must be a number or bigint

Received has type: symbol
Received has value: <red>Symbol(0.1)</>"
Expand All @@ -665,7 +665,7 @@ Received has value: <red>Symbol(0.1)</>"
exports[`.toBeCloseTo() throws: Matcher error promise resolves isNot false received 1`] = `
"<dim>expect(</><red>received</><dim>).</>resolves<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>, </><green>precision</><dim>)</>

<bold>Matcher error</>: <red>received</> value must be a number
<bold>Matcher error</>: <red>received</> value must be a number or bigint

Received has type: boolean
Received has value: <red>false</>"
Expand All @@ -674,7 +674,7 @@ Received has value: <red>false</>"
exports[`.toBeCloseTo() throws: Matcher error promise resolves isNot true expected 1`] = `
"<dim>expect(</><red>received</><dim>).</>resolves<dim>.</>not<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>, </><green>precision</><dim>)</>

<bold>Matcher error</>: <green>expected</> value must be a number
<bold>Matcher error</>: <green>expected</> value must be a number or bigint

Expected has value: <green>null</>"
`;
Expand Down