Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function processResult(result: Result): Result {
const root = require('jest-util').getPackageRoot();
const jestConfig = getJestConfig(root).config;
let sourceCache = {};
let coveredFiles = [];
let basepath = path.join(jestConfig.cacheDirectory, '/ts-jest/');
if (!fs.existsSync(basepath)) {
fs.mkdirSync(basepath);
}
let cachedFiles = fs.readdirSync(basepath);
cachedFiles.map((p) => {
let filename = new Buffer(p.replace(basepath, ''), 'base64').toString('utf8');
// add back root part of filename
// the root part was removed in the preprocessor.ts file to get shorter file names
// long file names could be problematic in some OS
// see https://github.com/kulshekhar/ts-jest/issues/158
filename = root + filename;