UNPKG

3.05 kBJavaScriptView Raw
1"use strict";
2var __read = (this && this.__read) || function (o, n) {
3 var m = typeof Symbol === "function" && o[Symbol.iterator];
4 if (!m) return o;
5 var i = m.call(o), r, ar = [], e;
6 try {
7 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8 }
9 catch (error) { e = { error: error }; }
10 finally {
11 try {
12 if (r && !r.done && (m = i["return"])) m.call(i);
13 }
14 finally { if (e) throw e.error; }
15 }
16 return ar;
17};
18var __spread = (this && this.__spread) || function () {
19 for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
20 return ar;
21};
22Object.defineProperty(exports, "__esModule", { value: true });
23var _a;
24var bs_logger_1 = require("bs-logger");
25var fs_1 = require("fs");
26var path_1 = require("path");
27var create_jest_preset_1 = require("./config/create-jest-preset");
28var paths_to_module_name_mapper_1 = require("./config/paths-to-module-name-mapper");
29var ts_jest_transformer_1 = require("./ts-jest-transformer");
30var logger_1 = require("./util/logger");
31var messages_1 = require("./util/messages");
32var testing_1 = require("./util/testing");
33var version_checkers_1 = require("./util/version-checkers");
34var warn = logger_1.rootLogger.child((_a = {}, _a[bs_logger_1.LogContexts.logLevel] = bs_logger_1.LogLevels.warn, _a));
35var helperMoved = function (name, helper) {
36 return warn.wrap(messages_1.interpolate(messages_1.Deprecateds.HelperMovedToUtils, { helper: name }), helper);
37};
38exports.mocked = helperMoved('mocked', testing_1.mocked);
39exports.createJestPreset = helperMoved('createJestPreset', create_jest_preset_1.createJestPreset);
40exports.pathsToModuleNameMapper = helperMoved('pathsToModuleNameMapper', paths_to_module_name_mapper_1.pathsToModuleNameMapper);
41exports.version = require('../package.json').version;
42exports.digest = fs_1.readFileSync(path_1.resolve(__dirname, '..', '.ts-jest-digest'), 'utf8');
43var transformer;
44function defaultTransformer() {
45 return transformer || (transformer = createTransformer());
46}
47function createTransformer(baseConfig) {
48 version_checkers_1.VersionCheckers.jest.warn();
49 return new ts_jest_transformer_1.TsJestTransformer(baseConfig);
50}
51exports.createTransformer = createTransformer;
52function process() {
53 var args = [];
54 for (var _i = 0; _i < arguments.length; _i++) {
55 args[_i] = arguments[_i];
56 }
57 var _a;
58 return (_a = defaultTransformer()).process.apply(_a, __spread(args));
59}
60exports.process = process;
61function getCacheKey() {
62 var args = [];
63 for (var _i = 0; _i < arguments.length; _i++) {
64 args[_i] = arguments[_i];
65 }
66 var _a;
67 return (_a = defaultTransformer()).getCacheKey.apply(_a, __spread(args));
68}
69exports.getCacheKey = getCacheKey;
70exports.canInstrument = false;
71var jestPreset = create_jest_preset_1.createJestPreset();
72exports.jestPreset = jestPreset;
73exports.__singleton = function () { return transformer; };
74exports.__resetModule = function () { return (transformer = undefined); };