Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getFileCachePath = (
filename,
config,
content,
instrument) =>
{
const baseCacheDir = getCacheFilePath(
config.cacheDirectory,
'jest-transform-cache-' + config.name,
VERSION);
const cacheKey = getCacheKey(content, filename, config, instrument);
// Create sub folders based on the cacheKey to avoid creating one
// directory with many files.
const cacheDir = path.join(baseCacheDir, cacheKey[0] + cacheKey[1]);
const cachePath = path.join(
cacheDir,
path.basename(filename, path.extname(filename)) + '_' + cacheKey);
createDirectory(cacheDir);
return cachePath;
};