Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Exclude console.error plugin for DevTools packages
  • Loading branch information
gaearon committed Dec 16, 2019
commit 3233d7848748ca0e49b49ce6cfa900f2d62d6e05
11 changes: 7 additions & 4 deletions scripts/jest/preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ module.exports = {
// for test files, we also apply the async-await transform, but we want to
// make sure we don't accidentally apply that transform to product code.
const isTestFile = !!filePath.match(/\/__tests__\//);
const isInDevToolsPackages = !!filePath.match(
/\/packages\/react-devtools.*\//
);
const testOnlyPlugins = [pathToBabelPluginAsyncToGenerator];
const sourceOnlyPlugins =
process.env.NODE_ENV === 'development'
? [pathToBabelPluginReplaceConsoleCalls]
: [];
const sourceOnlyPlugins = [];
if (process.env.NODE_ENV === 'development' && !isInDevToolsPackages) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

sourceOnlyPlugins.push(pathToBabelPluginReplaceConsoleCalls);
}
const plugins = (isTestFile ? testOnlyPlugins : sourceOnlyPlugins).concat(
babelOptions.plugins
);
Expand Down