Skip to content

Commit

Permalink
Remove babel plugins from jest preprocessor which are part of preset
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jacdebug authored and facebook-github-bot committed May 12, 2022
1 parent d4b59cd commit 2c5a966
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 37 deletions.
2 changes: 2 additions & 0 deletions Libraries/Network/__tests__/XMLHttpRequest-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @emails oncall+react_native
*/

'use strict';

import createPerformanceLogger from '../../Utilities/createPerformanceLogger';

jest.unmock('../../Utilities/Platform');
Expand Down
37 changes: 0 additions & 37 deletions jest/private/preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 2c5a966

Please sign in to comment.