diff --git a/packages/jest-transform/src/ScriptTransformer.ts b/packages/jest-transform/src/ScriptTransformer.ts index adaabfaef07c..548b460813e9 100644 --- a/packages/jest-transform/src/ScriptTransformer.ts +++ b/packages/jest-transform/src/ScriptTransformer.ts @@ -542,7 +542,13 @@ class ScriptTransformer { let shouldCallTransform = false; + // success + // success + if (cacheFilePath) { + createDirectory(path.dirname(cacheFilePath)); + } if (transformer && this.shouldTransform(filename)) { + // failed shouldCallTransform = true; const process = transformer.processAsync ?? transformer.process; @@ -810,11 +816,13 @@ class ScriptTransformer { } } - shouldTransform(filename: string): boolean { + shouldTransform(filename: string, cacheFilePath?: string): boolean { + // failed const ignoreRegexp = this._cache.ignorePatternsRegExp; const isIgnored = ignoreRegexp ? ignoreRegexp.test(filename) : false; return this._config.transform.length !== 0 && !isIgnored; + // failed } }