From f9e174374756f0fa226777a59304fea6a036b751 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Fri, 30 Jun 2023 16:01:59 -0400 Subject: [PATCH] Don't transpile async/await in tests Modern runtimes support native async/await, as does the version of Node we use for our tests. To match how most of our users run React, this disables the transpilation of async/await in our test suite. --- package.json | 1 - scripts/jest/preprocessor.js | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/package.json b/package.json index 92d90cc5a1f27..494097f3dbac5 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "@babel/plugin-syntax-jsx": "^7.10.4", "@babel/plugin-syntax-typescript": "^7.14.5", "@babel/plugin-transform-arrow-functions": "^7.10.4", - "@babel/plugin-transform-async-to-generator": "^7.10.4", "@babel/plugin-transform-block-scoped-functions": "^7.10.4", "@babel/plugin-transform-block-scoping": "^7.11.1", "@babel/plugin-transform-classes": "^7.10.4", diff --git a/scripts/jest/preprocessor.js b/scripts/jest/preprocessor.js index 91f629c85f923..7b9f9e9e9abdf 100644 --- a/scripts/jest/preprocessor.js +++ b/scripts/jest/preprocessor.js @@ -17,9 +17,6 @@ const pathToBabel = path.join( const pathToBabelPluginReplaceConsoleCalls = require.resolve( '../babel/transform-replace-console-calls' ); -const pathToBabelPluginAsyncToGenerator = require.resolve( - '@babel/plugin-transform-async-to-generator' -); const pathToTransformInfiniteLoops = require.resolve( '../babel/transform-prevent-infinite-loops' ); @@ -78,7 +75,7 @@ module.exports = { const isInDevToolsPackages = !!filePath.match( /\/packages\/react-devtools.*\// ); - const testOnlyPlugins = [pathToBabelPluginAsyncToGenerator]; + const testOnlyPlugins = []; const sourceOnlyPlugins = []; if (process.env.NODE_ENV === 'development' && !isInDevToolsPackages) { sourceOnlyPlugins.push(pathToBabelPluginReplaceConsoleCalls);