UNPKG

434 BJavaScriptView Raw
1// Copied from https://github.com/facebook/jest/blob/master/packages/jest-config/src/utils.js
2// in order to reduce incompatible jest dependencies
3
4const path = require('path');
5
6module.exports = {
7 replaceRootDirInPath : (rootDir,filePath) => {
8 if (!/^<rootDir>/.test(filePath)) {
9 return filePath;
10 }
11
12 return path.resolve(
13 rootDir,
14 path.normalize('./' + filePath.substr('<rootDir>'.length))
15 )
16 }
17}