Skip to content

Commit 08ef4d6

Browse files
DEV CI
1 parent ac8ec97 commit 08ef4d6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/jest-transform/src/ScriptTransformer.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ class ScriptTransformer {
220220
const cacheFilenamePrefix = path
221221
.basename(filename, path.extname(filename))
222222
.replace(/\W/g, '');
223-
return slash(path.join(cacheDir, `${cacheFilenamePrefix}_${cacheKey}`));
223+
return slash(
224+
path.join(cacheDir, `${cacheFilenamePrefix}_${cacheKey}`),
225+
);
224226
}
225227

226228
private _getFileCachePath(
@@ -240,7 +242,9 @@ class ScriptTransformer {
240242
): Promise<string> {
241243
const cacheKey = await this._getCacheKeyAsync(content, filename, options);
242244

243-
return this._createCachedFilename(filename, cacheKey);
245+
const tmp = this._createCachedFilename(filename, cacheKey);
246+
// createDirectory(path.dirname(tmp));
247+
return tmp;
244248
}
245249

246250
private _getTransformPath(filename: string) {
@@ -462,6 +466,7 @@ class ScriptTransformer {
462466
const {transformer, transformerConfig = {}} =
463467
this._getTransformer(filename) ?? {};
464468
const cacheFilePath = this._getFileCachePath(filename, content, options);
469+
createDirectory(path.dirname(cacheFilePath));
465470
const sourceMapPath = `${cacheFilePath}.map`;
466471
// Ignore cache if `config.cache` is set (--no-cache)
467472
const code = this._config.cache ? readCodeCacheFile(cacheFilePath) : null;
@@ -522,6 +527,7 @@ class ScriptTransformer {
522527
content,
523528
options,
524529
);
530+
createDirectory(path.dirname(cacheFilePath));
525531
const sourceMapPath = `${cacheFilePath}.map`;
526532
// Ignore cache if `config.cache` is set (--no-cache)
527533
const code = this._config.cache ? readCodeCacheFile(cacheFilePath) : null;

0 commit comments

Comments
 (0)