Don't transpile async/await in tests (#27029)
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.
Andrew Clark committed
Jun 30, 2023 at 16:29 UTC
47385f8fa448e52326f08d0afa357339fac6f86e
2 files changed
+1
-5
package.json
-1
@@ -18,7 +18,6 @@
18
"@babel/plugin-syntax-jsx": "^7.10.4",
19
"@babel/plugin-syntax-typescript": "^7.14.5",
20
"@babel/plugin-transform-arrow-functions": "^7.10.4",
21
- "@babel/plugin-transform-async-to-generator": "^7.10.4",
21
"@babel/plugin-transform-block-scoped-functions": "^7.10.4",
22
"@babel/plugin-transform-block-scoping": "^7.11.1",
23
"@babel/plugin-transform-classes": "^7.10.4",
scripts/jest/preprocessor.js
+1
-4
@@ -17,9 +17,6 @@ const pathToBabel = path.join(
17
const pathToBabelPluginReplaceConsoleCalls = require.resolve(
18
'../babel/transform-replace-console-calls'
19
);
20
-const pathToBabelPluginAsyncToGenerator = require.resolve(
21
- '@babel/plugin-transform-async-to-generator'
22
-);
20
const pathToTransformInfiniteLoops = require.resolve(
21
'../babel/transform-prevent-infinite-loops'
22
);
@@ -78,7 +75,7 @@ module.exports = {
75
const isInDevToolsPackages = !!filePath.match(
76
/\/packages\/react-devtools.*\//
77
);
81
- const testOnlyPlugins = [pathToBabelPluginAsyncToGenerator];
78
+ const testOnlyPlugins = [];
79
const sourceOnlyPlugins = [];
80
if (process.env.NODE_ENV === 'development' && !isInDevToolsPackages) {
81
sourceOnlyPlugins.push(pathToBabelPluginReplaceConsoleCalls);