mirror of
https://github.com/Azure/setup-helm.git
synced 2025-10-20 17:46:30 +00:00
v2 new release (#77)
This commit is contained in:
committed by
GitHub
parent
217bf70cbd
commit
199ab446df
27
node_modules/ts-jest/dist/config/paths-to-module-name-mapper.js
generated
vendored
27
node_modules/ts-jest/dist/config/paths-to-module-name-mapper.js
generated
vendored
@@ -12,14 +12,15 @@ var __values = (this && this.__values) || function(o) {
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pathsToModuleNameMapper = void 0;
|
||||
var bs_logger_1 = require("bs-logger");
|
||||
var logger_1 = require("../util/logger");
|
||||
var messages_1 = require("../util/messages");
|
||||
var logger_1 = require("../utils/logger");
|
||||
var messages_1 = require("../utils/messages");
|
||||
var escapeRegex = function (str) { return str.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); };
|
||||
var logger = logger_1.rootLogger.child((_a = {}, _a[bs_logger_1.LogContexts.namespace] = 'path-mapper', _a));
|
||||
exports.pathsToModuleNameMapper = function (mapping, _a) {
|
||||
var e_1, _b;
|
||||
var _c = (_a === void 0 ? {} : _a).prefix, prefix = _c === void 0 ? '' : _c;
|
||||
var _c = (_a === void 0 ? Object.create(null) : _a).prefix, prefix = _c === void 0 ? '' : _c;
|
||||
var jestMap = {};
|
||||
try {
|
||||
for (var _d = __values(Object.keys(mapping)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
||||
@@ -30,25 +31,25 @@ exports.pathsToModuleNameMapper = function (mapping, _a) {
|
||||
logger.warn(messages_1.interpolate("Not mapping \"{{path}}\" because it has no target.", { path: fromPath }));
|
||||
continue;
|
||||
}
|
||||
else if (toPaths.length > 1) {
|
||||
logger.warn(messages_1.interpolate("Mapping only to first target of \"{{path}}\" because it has more than one ({{count}}).", {
|
||||
path: fromPath,
|
||||
count: toPaths.length,
|
||||
}));
|
||||
}
|
||||
var target = toPaths[0];
|
||||
var segments = fromPath.split(/\*/g);
|
||||
if (segments.length === 1) {
|
||||
var paths = toPaths.map(function (target) {
|
||||
var enrichedPrefix = prefix !== '' && !prefix.endsWith('/') ? prefix + "/" : prefix;
|
||||
return "" + enrichedPrefix + target;
|
||||
});
|
||||
pattern = "^" + escapeRegex(fromPath) + "$";
|
||||
jestMap[pattern] = "" + prefix + target;
|
||||
jestMap[pattern] = paths.length === 1 ? paths[0] : paths;
|
||||
}
|
||||
else if (segments.length === 2) {
|
||||
var paths = toPaths.map(function (target) {
|
||||
var enrichedPrefix = prefix !== '' && !prefix.endsWith('/') ? prefix + "/" : prefix;
|
||||
return "" + enrichedPrefix + target.replace(/\*/g, '$1');
|
||||
});
|
||||
pattern = "^" + escapeRegex(segments[0]) + "(.*)" + escapeRegex(segments[1]) + "$";
|
||||
jestMap[pattern] = "" + prefix + target.replace(/\*/g, '$1');
|
||||
jestMap[pattern] = paths.length === 1 ? paths[0] : paths;
|
||||
}
|
||||
else {
|
||||
logger.warn(messages_1.interpolate("Not mapping \"{{path}}\" because it has more than one star (`*`).", { path: fromPath }));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user