diff --git a/packages/jest-transform/src/ScriptTransformer.ts b/packages/jest-transform/src/ScriptTransformer.ts index 1f7506b7af0e..ddd3facadebe 100644 --- a/packages/jest-transform/src/ScriptTransformer.ts +++ b/packages/jest-transform/src/ScriptTransformer.ts @@ -658,17 +658,17 @@ const calcIgnorePatternRegExp = (config: Config.ProjectConfig) => { return new RegExp(config.transformIgnorePatterns.join('|')); }; -const calcTransformRegExp = (config: Config.ProjectConfig) => { - if (!config.transform.length) { +const calcTransformRegExp = ({transform = []}: Config.ProjectConfig) => { + if (!transform.length) { return undefined; } const transformRegexp: Array<[RegExp, string, Record]> = []; - for (let i = 0; i < config.transform.length; i++) { + for (let i = 0; i < transform.length; i++) { transformRegexp.push([ - new RegExp(config.transform[i][0]), - config.transform[i][1], - config.transform[i][2], + new RegExp(transform[i][0]), + transform[i][1], + transform[i][2], ]); }