UNPKG

@teambit/jest

Version:
34 lines (32 loc) 917 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRootDirFromConfigPath = getRootDirFromConfigPath; function _lodash() { const data = require("lodash"); _lodash = function () { return data; }; return data; } function _path() { const data = require("path"); _path = function () { return data; }; return data; } function getRootDirFromConfigPath(configPath) { const splitted = configPath.split('node_modules'); const last = splitted[splitted.length - 1]; const lastSplitted = (0, _lodash().compact)(last.split(_path().sep)); let lastModule = lastSplitted[0]; if (lastSplitted[0].startsWith('@')) { lastModule = (0, _path().join)(lastSplitted[0], lastSplitted[1]); } splitted[splitted.length - 1] = `${_path().sep}${lastModule}`; const final = splitted.join('node_modules'); return final; } //# sourceMappingURL=calc-root-dir.js.map