dts-jest
Version:
A preprocessor for Jest to snapshot test TypeScript declaration (.d.ts) files
26 lines (25 loc) • 1.6 kB
JavaScript
;
exports.__esModule = true;
var load_compiler_options_1 = require("./load-compiler-options");
var load_typescript_1 = require("./load-typescript");
var replace_cwd_1 = require("./replace-cwd");
exports.normalize_config = function (raw_config) {
if (raw_config === void 0) { raw_config = {}; }
// istanbul ignore next
var _a = raw_config.test_type, test_type = _a === void 0 ? true : _a, _b = raw_config.test_value, test_value = _b === void 0 ? false : _b, _c = raw_config.compiler_options, raw_compiler_options = _c === void 0 ? {} : _c, _d = raw_config.enclosing_declaration, enclosing_declaration = _d === void 0 ? false : _d, _e = raw_config.typescript, typescript_id = _e === void 0 ? 'typescript' : _e, _f = raw_config.transpile, transpile = _f === void 0 ? true : _f;
var _g = load_typescript_1.load_typescript(replace_cwd_1.replace_cwd(typescript_id)), typescript = _g.typescript, typescript_path = _g.typescript_path;
// istanbul ignore next
var _h = raw_config.type_format_flags, type_format_flags = _h === void 0 ? typescript.TypeFormatFlags.NoTruncation : _h;
var compiler_options = load_compiler_options_1.load_compiler_options(raw_compiler_options, typescript);
return {
transpile: transpile,
test_type: test_type,
test_value: test_value,
compiler_options: compiler_options.options,
file_names: compiler_options.file_names,
type_format_flags: type_format_flags,
enclosing_declaration: enclosing_declaration,
typescript: typescript,
typescript_path: typescript_path
};
};