Skip to content

Commit

Permalink
Allow additional Jest config keys (#6055)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmfriedman authored and mrmckeb committed May 12, 2019
1 parent 57ef103 commit e2f43a0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/react-scripts/scripts/utils/createJestConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,25 @@ module.exports = (resolve, rootDir, isEjecting) => {
'extraGlobals',
'globalSetup',
'globalTeardown',
'moduleNameMapper',
'resetMocks',
'resetModules',
'snapshotSerializers',
'transform',
'transformIgnorePatterns',
'watchPathIgnorePatterns',
];
if (overrides) {
supportedKeys.forEach(key => {
if (overrides.hasOwnProperty(key)) {
config[key] = overrides[key];
if (Array.isArray(config[key]) || typeof config[key] !== 'object') {
// for arrays or primitive types, directly override the config key
config[key] = overrides[key];
} else {
// for object types, extend gracefully
config[key] = Object.assign({}, config[key], overrides[key]);
}

delete overrides[key];
}
});
Expand Down

1 comment on commit e2f43a0

@m-ismaieel
Copy link

Choose a reason for hiding this comment

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

Hi,

Do you have any idea when next release will be available so this PR will be included? or could you help me use this PR changes as I need moduleNameMapper to be able to use Jest.
I noticed that, (yarn add --exact [email protected]) command was required to use react-scripts from 3.0.1 release. While this change affects react-scripts what command(s) shall I use to be able to use moduleNameMapper option?

Thanks.

Please sign in to comment.