From 4c4f5fd27fc1d7c16033a1221c9440cd67baace5 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 14 Aug 2019 19:04:43 -0700 Subject: [PATCH] Disable @babel/plugin-transform-block-scoping "throwIfClosureRequired" option for tests --- scripts/jest/preprocessor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/jest/preprocessor.js b/scripts/jest/preprocessor.js index 44642ec91888d..b04daaee886b5 100644 --- a/scripts/jest/preprocessor.js +++ b/scripts/jest/preprocessor.js @@ -40,6 +40,10 @@ const babelOptions = { require.resolve('@babel/plugin-transform-react-jsx-source'), require.resolve('../babel/transform-prevent-infinite-loops'), + + // This optimization is important for extremely performance-sensitive (e.g. React source). + // It's okay to disable it for tests. + [require.resolve('@babel/plugin-transform-block-scoping'), {throwIfClosureRequired: false}], ], retainLines: true, };