From 2c5a966054c2a80d63aa9c2c2a234a80a02918cf Mon Sep 17 00:00:00 2001 From: Deepak Jacob Date: Thu, 12 May 2022 03:48:24 -0700 Subject: [PATCH] Remove babel plugins from jest preprocessor which are part of preset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Changelog: [Internal][Changed] - Remove babel plugins from jest preprocessor which are part of preset metro-react-native-babel-preset Transformer metro-react-native-babel-transformer has preset metro-react-native-babel-preset which has necessary plugins to transpile the source. So we don’t need to pass it again in the preprocessor. As part of the change, updated one test to use strict mode since metro-react-native-babel-preset has strictMode is set to false. Reviewed By: motiz88 Differential Revision: D34868961 fbshipit-source-id: 71678f1ee6f1b5ebf9a0c6fd2d6444a61d7583ac --- .../Network/__tests__/XMLHttpRequest-test.js | 2 + jest/private/preprocessor.js | 37 ------------------- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/Libraries/Network/__tests__/XMLHttpRequest-test.js b/Libraries/Network/__tests__/XMLHttpRequest-test.js index 6463179986788a..d2500ae75f3f8b 100644 --- a/Libraries/Network/__tests__/XMLHttpRequest-test.js +++ b/Libraries/Network/__tests__/XMLHttpRequest-test.js @@ -8,6 +8,8 @@ * @emails oncall+react_native */ +'use strict'; + import createPerformanceLogger from '../../Utilities/createPerformanceLogger'; jest.unmock('../../Utilities/Platform'); diff --git a/jest/private/preprocessor.js b/jest/private/preprocessor.js index 09c0140f033f39..c908e48da773a3 100644 --- a/jest/private/preprocessor.js +++ b/jest/private/preprocessor.js @@ -59,43 +59,6 @@ module.exports = { sourceType: 'unambiguous', // b7 required. detects module vs script mode }, src, - plugins: [ - [require('@babel/plugin-transform-block-scoping')], - // the flow strip types plugin must go BEFORE class properties! - // there'll be a test case that fails if you don't. - [require('@babel/plugin-transform-flow-strip-types')], - [ - require('@babel/plugin-proposal-class-properties'), - // use `this.foo = bar` instead of `this.defineProperty('foo', ...)` - {loose: true}, - ], - [require('@babel/plugin-transform-computed-properties')], - [require('@babel/plugin-transform-destructuring')], - [require('@babel/plugin-transform-function-name')], - [require('@babel/plugin-transform-literals')], - [require('@babel/plugin-transform-parameters')], - [require('@babel/plugin-transform-shorthand-properties')], - [require('@babel/plugin-transform-react-jsx')], - [require('@babel/plugin-transform-regenerator')], - [require('@babel/plugin-transform-sticky-regex')], - [require('@babel/plugin-transform-unicode-regex')], - [ - require('@babel/plugin-transform-modules-commonjs'), - {strict: false, allowTopLevelThis: true}, - ], - [require('@babel/plugin-transform-classes')], - [require('@babel/plugin-transform-arrow-functions')], - [require('@babel/plugin-transform-spread')], - [require('@babel/plugin-proposal-object-rest-spread')], - [ - require('@babel/plugin-transform-template-literals'), - {loose: true}, // dont 'a'.concat('b'), just use 'a'+'b' - ], - [require('@babel/plugin-transform-exponentiation-operator')], - [require('@babel/plugin-transform-for-of'), {loose: true}], - [require('@babel/plugin-transform-react-display-name')], - [require('@babel/plugin-transform-react-jsx-source')], - ], }); return generate(