Skip to content

Commit

Permalink
Don't transpile async/await in tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
acdlite committed Jun 30, 2023
1 parent 1fdacbe commit 5e7136d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions scripts/jest/preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5e7136d

Please sign in to comment.