Skip to content

Commit 44a960d

Browse files
authored
feat: enable all babel syntax plugins (#9774)
1 parent 2edd5c4 commit 44a960d

4 files changed

Lines changed: 41 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Features
44

55
- `[babel-jest]` Support passing `supportsDynamicImport` and `supportsStaticESM` ([#9766](https://github.com/facebook/jest/pull/9766))
6+
- `[babel-preset-jest]` Enable all syntax plugins not enabled by default that works on current version of Node ([#9774](https://github.com/facebook/jest/pull/9774))
67
- `[jest-runtime, @jest/transformer]` Support passing `supportsDynamicImport` and `supportsStaticESM` ([#9597](https://github.com/facebook/jest/pull/9597))
78

89
### Fixes

packages/babel-preset-jest/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
module.exports = () => ({
9-
plugins: [
10-
require.resolve('babel-plugin-jest-hoist'),
11-
require.resolve('@babel/plugin-syntax-object-rest-spread'),
12-
require.resolve('@babel/plugin-syntax-bigint'),
13-
],
14-
});
8+
const jestPreset = {
9+
plugins: [require.resolve('babel-plugin-jest-hoist')],
10+
presets: [require.resolve('babel-preset-current-node-syntax')],
11+
};
12+
13+
// @babel/core requires us to export a function
14+
module.exports = () => jestPreset;

packages/babel-preset-jest/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
"license": "MIT",
1010
"main": "index.js",
1111
"dependencies": {
12-
"@babel/plugin-syntax-bigint": "^7.0.0",
13-
"@babel/plugin-syntax-object-rest-spread": "^7.0.0",
14-
"babel-plugin-jest-hoist": "^25.2.6"
12+
"babel-plugin-jest-hoist": "^25.2.6",
13+
"babel-preset-current-node-syntax": "^0.1.2"
1514
},
1615
"peerDependencies": {
1716
"@babel/core": "^7.0.0"

yarn.lock

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -416,21 +416,21 @@
416416
"@babel/helper-create-regexp-features-plugin" "^7.8.8"
417417
"@babel/helper-plugin-utils" "^7.8.3"
418418

419-
"@babel/plugin-syntax-async-generators@^7.8.0":
419+
"@babel/plugin-syntax-async-generators@^7.8.0", "@babel/plugin-syntax-async-generators@^7.8.4":
420420
version "7.8.4"
421421
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d"
422422
integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==
423423
dependencies:
424424
"@babel/helper-plugin-utils" "^7.8.0"
425425

426-
"@babel/plugin-syntax-bigint@^7.0.0":
426+
"@babel/plugin-syntax-bigint@^7.8.3":
427427
version "7.8.3"
428428
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea"
429429
integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==
430430
dependencies:
431431
"@babel/helper-plugin-utils" "^7.8.0"
432432

433-
"@babel/plugin-syntax-class-properties@^7.0.0":
433+
"@babel/plugin-syntax-class-properties@^7.0.0", "@babel/plugin-syntax-class-properties@^7.8.3":
434434
version "7.8.3"
435435
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.8.3.tgz#6cb933a8872c8d359bfde69bbeaae5162fd1e8f7"
436436
integrity sha512-UcAyQWg2bAN647Q+O811tG9MrJ38Z10jjhQdKNAL8fsyPzE3cCN/uT+f55cFVY4aGO4jqJAvmqsuY3GQDwAoXg==
@@ -465,7 +465,7 @@
465465
dependencies:
466466
"@babel/helper-plugin-utils" "^7.8.3"
467467

468-
"@babel/plugin-syntax-json-strings@^7.8.0":
468+
"@babel/plugin-syntax-json-strings@^7.8.0", "@babel/plugin-syntax-json-strings@^7.8.3":
469469
version "7.8.3"
470470
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a"
471471
integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==
@@ -479,7 +479,14 @@
479479
dependencies:
480480
"@babel/helper-plugin-utils" "^7.8.3"
481481

482-
"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.0":
482+
"@babel/plugin-syntax-logical-assignment-operators@^7.8.3":
483+
version "7.8.3"
484+
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.8.3.tgz#3995d7d7ffff432f6ddc742b47e730c054599897"
485+
integrity sha512-Zpg2Sgc++37kuFl6ppq2Q7Awc6E6AIW671x5PY8E/f7MCIyPPGK/EoeZXvvY3P42exZ3Q4/t3YOzP/HiN79jDg==
486+
dependencies:
487+
"@babel/helper-plugin-utils" "^7.8.3"
488+
489+
"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.0", "@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3":
483490
version "7.8.3"
484491
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9"
485492
integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==
@@ -493,21 +500,21 @@
493500
dependencies:
494501
"@babel/helper-plugin-utils" "^7.8.3"
495502

496-
"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.8.0":
503+
"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.8.0", "@babel/plugin-syntax-object-rest-spread@^7.8.3":
497504
version "7.8.3"
498505
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871"
499506
integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==
500507
dependencies:
501508
"@babel/helper-plugin-utils" "^7.8.0"
502509

503-
"@babel/plugin-syntax-optional-catch-binding@^7.8.0":
510+
"@babel/plugin-syntax-optional-catch-binding@^7.8.0", "@babel/plugin-syntax-optional-catch-binding@^7.8.3":
504511
version "7.8.3"
505512
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1"
506513
integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==
507514
dependencies:
508515
"@babel/helper-plugin-utils" "^7.8.0"
509516

510-
"@babel/plugin-syntax-optional-chaining@^7.8.0":
517+
"@babel/plugin-syntax-optional-chaining@^7.8.0", "@babel/plugin-syntax-optional-chaining@^7.8.3":
511518
version "7.8.3"
512519
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a"
513520
integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==
@@ -3443,6 +3450,22 @@ babel-polyfill@6.23.0:
34433450
core-js "^2.4.0"
34443451
regenerator-runtime "^0.10.0"
34453452

3453+
babel-preset-current-node-syntax@^0.1.2:
3454+
version "0.1.2"
3455+
resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-0.1.2.tgz#fb4a4c51fe38ca60fede1dc74ab35eb843cb41d6"
3456+
integrity sha512-u/8cS+dEiK1SFILbOC8/rUI3ml9lboKuuMvZ/4aQnQmhecQAgPw5ew066C1ObnEAUmlx7dv/s2z52psWEtLNiw==
3457+
dependencies:
3458+
"@babel/plugin-syntax-async-generators" "^7.8.4"
3459+
"@babel/plugin-syntax-bigint" "^7.8.3"
3460+
"@babel/plugin-syntax-class-properties" "^7.8.3"
3461+
"@babel/plugin-syntax-json-strings" "^7.8.3"
3462+
"@babel/plugin-syntax-logical-assignment-operators" "^7.8.3"
3463+
"@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3"
3464+
"@babel/plugin-syntax-numeric-separator" "^7.8.3"
3465+
"@babel/plugin-syntax-object-rest-spread" "^7.8.3"
3466+
"@babel/plugin-syntax-optional-catch-binding" "^7.8.3"
3467+
"@babel/plugin-syntax-optional-chaining" "^7.8.3"
3468+
34463469
babel-preset-fbjs@^3.1.2, babel-preset-fbjs@^3.2.0:
34473470
version "3.3.0"
34483471
resolved "https://registry.yarnpkg.com/babel-preset-fbjs/-/babel-preset-fbjs-3.3.0.tgz#a6024764ea86c8e06a22d794ca8b69534d263541"

0 commit comments

Comments
 (0)