UNPKG

jest-module-name-mapper

Version:

Synchronization tsconfig paths with Jest (module name mapper)

17 lines (16 loc) 628 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const chalk_1 = tslib_1.__importDefault(require("chalk")); const fs = tslib_1.__importStar(require("fs")); const getConfigPath = (configPath) => !!configPath ? `${process.cwd()}/${configPath}` : `${process.cwd()}/tsconfig.json`; exports.getConfig = (configPath) => { const tsconfigPath = getConfigPath(configPath); if (!fs.existsSync(tsconfigPath)) { console.error(chalk_1.default.red(`${tsconfigPath} file does not exist`)); process.exit(); } return require(tsconfigPath); };