From 08ef4d6b354f2e436580a8ce183398e999121df1 Mon Sep 17 00:00:00 2001 From: Mitchell Hentges Date: Fri, 14 Oct 2022 18:34:48 +0100 Subject: [PATCH] DEV CI --- packages/jest-transform/src/ScriptTransformer.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/jest-transform/src/ScriptTransformer.ts b/packages/jest-transform/src/ScriptTransformer.ts index 63e3ca1e2d7a..455b3f851611 100644 --- a/packages/jest-transform/src/ScriptTransformer.ts +++ b/packages/jest-transform/src/ScriptTransformer.ts @@ -220,7 +220,9 @@ class ScriptTransformer { const cacheFilenamePrefix = path .basename(filename, path.extname(filename)) .replace(/\W/g, ''); - return slash(path.join(cacheDir, `${cacheFilenamePrefix}_${cacheKey}`)); + return slash( + path.join(cacheDir, `${cacheFilenamePrefix}_${cacheKey}`), + ); } private _getFileCachePath( @@ -240,7 +242,9 @@ class ScriptTransformer { ): Promise { const cacheKey = await this._getCacheKeyAsync(content, filename, options); - return this._createCachedFilename(filename, cacheKey); + const tmp = this._createCachedFilename(filename, cacheKey); + // createDirectory(path.dirname(tmp)); + return tmp; } private _getTransformPath(filename: string) { @@ -462,6 +466,7 @@ class ScriptTransformer { const {transformer, transformerConfig = {}} = this._getTransformer(filename) ?? {}; const cacheFilePath = this._getFileCachePath(filename, content, options); + createDirectory(path.dirname(cacheFilePath)); const sourceMapPath = `${cacheFilePath}.map`; // Ignore cache if `config.cache` is set (--no-cache) const code = this._config.cache ? readCodeCacheFile(cacheFilePath) : null; @@ -522,6 +527,7 @@ class ScriptTransformer { content, options, ); + createDirectory(path.dirname(cacheFilePath)); const sourceMapPath = `${cacheFilePath}.map`; // Ignore cache if `config.cache` is set (--no-cache) const code = this._config.cache ? readCodeCacheFile(cacheFilePath) : null;