1
0
Fork 0
mirror of https://github.com/actions/setup-python.git synced 2024-11-30 03:45:17 +00:00
setup-python/node_modules/ts-jest/dist/cli/helpers/presets.js

40 lines
1.6 KiB
JavaScript
Raw Normal View History

2019-06-27 01:12:00 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var JestPresetNames;
(function (JestPresetNames) {
JestPresetNames["default"] = "ts-jest/presets/default";
JestPresetNames["jsWithTs"] = "ts-jest/presets/js-with-ts";
JestPresetNames["jsWIthBabel"] = "ts-jest/presets/js-with-babel";
})(JestPresetNames = exports.JestPresetNames || (exports.JestPresetNames = {}));
var definePreset = function (fullName) { return ({
fullName: fullName,
get name() {
return this.isDefault ? 'ts-jest' : fullName;
},
get label() {
return fullName.split('/').pop();
},
get jsVarName() {
return this.isDefault
? 'defaults'
: fullName
.split('/')
.pop()
.replace(/\-([a-z])/g, function (_, l) { return l.toUpperCase(); });
},
get value() {
return require("../../../" + fullName.replace(/^ts-jest\//, '') + "/jest-preset");
},
jsImport: function (varName) {
if (varName === void 0) { varName = 'tsjPreset'; }
return "const { " + this.jsVarName + ": " + varName + " } = require('ts-jest/presets')";
},
get isDefault() {
return fullName === JestPresetNames.default;
},
}); };
exports.allPresets = {};
exports.defaults = (exports.allPresets[JestPresetNames.default] = definePreset(JestPresetNames.default));
exports.jsWithTs = (exports.allPresets[JestPresetNames.jsWithTs] = definePreset(JestPresetNames.jsWithTs));
exports.jsWIthBabel = (exports.allPresets[JestPresetNames.jsWIthBabel] = definePreset(JestPresetNames.jsWIthBabel));