diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index 5a47f7a6df36..953825f969c6 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -619,20 +619,20 @@ export default function normalize( const transform = oldOptions[key]; value = transform && - Object.keys(transform).map(regex => - [ + Object.keys(transform).map(regex => { + const transformElement = transform[regex]; + return [ regex, resolve(newOptions.resolver, { - filePath: Array.isArray(transform[regex]) - ? transform[regex][0] - : transform[regex], + filePath: Array.isArray(transformElement) + ? transformElement[0] + : transformElement, key, rootDir: options.rootDir, }), - ].concat( - Array.isArray(transform[regex]) ? [transform[regex][1]] : [], - ), - ); + ...(Array.isArray(transformElement) ? [transformElement[1]] : []), + ]; + }); break; case 'coveragePathIgnorePatterns': case 'modulePathIgnorePatterns':