allure-js-commons
Advanced tools
Comparing version 3.0.9 to 3.1.0
@@ -18,2 +18,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "getMetadataLabel", { | ||
enumerable: true, | ||
get: function get() { | ||
return _utils.getMetadataLabel; | ||
} | ||
}); | ||
Object.defineProperty(exports, "getStatusFromError", { | ||
@@ -20,0 +26,0 @@ enumerable: true, |
@@ -89,3 +89,3 @@ "use strict"; | ||
links: _links, | ||
globalLabels | ||
globalLabels = {} | ||
} = _ref; | ||
@@ -200,7 +200,2 @@ _defineProperty(this, "state", new _LifecycleState.LifecycleState()); | ||
this.notifier.beforeTestResultStop(testResult); | ||
(_testResult$testCaseI = testResult.testCaseId) !== null && _testResult$testCaseI !== void 0 ? _testResult$testCaseI : testResult.testCaseId = (0, _utils.getTestResultTestCaseId)(testResult); | ||
(_testResult$historyId = testResult.historyId) !== null && _testResult$historyId !== void 0 ? _testResult$historyId : testResult.historyId = (0, _utils.getTestResultHistoryId)(testResult); | ||
var startStop = _classPrivateFieldGet(_calculateTimings, this).call(this, testResult.start, opts === null || opts === void 0 ? void 0 : opts.stop, opts === null || opts === void 0 ? void 0 : opts.duration); | ||
testResult.start = startStop.start; | ||
testResult.stop = startStop.stop; | ||
var scopeUuids = wrapped.scopeUuids; | ||
@@ -228,2 +223,7 @@ scopeUuids.forEach(scopeUuid => { | ||
testResult.labels = [...this.globalLabels, ...testResult.labels]; | ||
(_testResult$testCaseI = testResult.testCaseId) !== null && _testResult$testCaseI !== void 0 ? _testResult$testCaseI : testResult.testCaseId = (0, _utils.getTestResultTestCaseId)(testResult); | ||
(_testResult$historyId = testResult.historyId) !== null && _testResult$historyId !== void 0 ? _testResult$historyId : testResult.historyId = (0, _utils.getTestResultHistoryId)(testResult); | ||
var startStop = _classPrivateFieldGet(_calculateTimings, this).call(this, testResult.start, opts === null || opts === void 0 ? void 0 : opts.stop, opts === null || opts === void 0 ? void 0 : opts.duration); | ||
testResult.start = startStop.start; | ||
testResult.stop = startStop.stop; | ||
this.notifier.afterTestResultStop(testResult); | ||
@@ -596,3 +596,19 @@ }); | ||
this.linkConfig = _links; | ||
this.globalLabels = globalLabels !== null && globalLabels !== void 0 ? globalLabels : []; | ||
if (Array.isArray(globalLabels)) { | ||
this.globalLabels = globalLabels; | ||
} else if (Object.keys(globalLabels).length) { | ||
this.globalLabels = Object.entries(globalLabels).flatMap(_ref3 => { | ||
var [name, value] = _ref3; | ||
if (Array.isArray(value)) { | ||
return value.map(v => ({ | ||
name, | ||
value: v | ||
})); | ||
} | ||
return { | ||
name, | ||
value | ||
}; | ||
}); | ||
} | ||
} | ||
@@ -599,0 +615,0 @@ } |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.stripAnsi = exports.serialize = exports.isPromise = exports.isMetadataTag = exports.isAnyStepFailed = exports.isAllStepsEnded = exports.hasStepMessage = exports.hasLabel = exports.getUnfinishedStepsMessages = exports.getStepsMessagesPair = exports.getStatusFromError = exports.getMessageAndTraceFromError = exports.extractMetadataFromString = exports.allureLabelRegexpGlobal = exports.allureLabelRegexp = exports.allureIdRegexpGlobal = exports.allureIdRegexp = void 0; | ||
exports.stripAnsi = exports.serialize = exports.isPromise = exports.isMetadataTag = exports.isAnyStepFailed = exports.isAllStepsEnded = exports.hasStepMessage = exports.hasLabel = exports.getValueFromAllureTitleMetadataMatch = exports.getUnfinishedStepsMessages = exports.getTypeFromAllureTitleMetadataMatch = exports.getStepsMessagesPair = exports.getStatusFromError = exports.getMetadataLabel = exports.getMessageAndTraceFromError = exports.extractMetadataFromString = exports.allureTitleMetadataRegexpGlobal = exports.allureTitleMetadataRegexp = exports.allureMetadataRegexp = exports.allureLabelRegexp = exports.allureIdRegexp = void 0; | ||
var _model = require("../model.js"); | ||
@@ -59,2 +59,22 @@ function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { var t = o[r]; return "$" + (Array.isArray(t) ? t.join("$") : t); })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); } | ||
exports.stripAnsi = stripAnsi; | ||
var actualAndExpected = value => { | ||
if (!value || typeof value !== "object") { | ||
return {}; | ||
} | ||
// support for jest asserts | ||
if ("matcherResult" in value && value.matcherResult !== undefined && typeof value.matcherResult === "object") { | ||
return { | ||
actual: serialize(value.matcherResult.actual), | ||
expected: serialize(value.matcherResult.expected) | ||
}; | ||
} | ||
var actual = "actual" in value && value.actual !== undefined ? { | ||
actual: serialize(value.actual) | ||
} : {}; | ||
var expected = "expected" in value && value.expected !== undefined ? { | ||
expected: serialize(value.expected) | ||
} : {}; | ||
return _objectSpread(_objectSpread({}, actual), expected); | ||
}; | ||
var getMessageAndTraceFromError = error => { | ||
@@ -65,18 +85,18 @@ var { | ||
} = error; | ||
var actual = "actual" in error && error.actual !== undefined ? { | ||
actual: serialize(error.actual) | ||
} : {}; | ||
var expected = "expected" in error && error.expected !== undefined ? { | ||
expected: serialize(error.expected) | ||
} : {}; | ||
return _objectSpread(_objectSpread({ | ||
return _objectSpread({ | ||
message: message ? stripAnsi(message) : undefined, | ||
trace: stack ? stripAnsi(stack) : undefined | ||
}, actual), expected); | ||
}, actualAndExpected(error)); | ||
}; | ||
exports.getMessageAndTraceFromError = getMessageAndTraceFromError; | ||
var allureIdRegexp = exports.allureIdRegexp = /*#__PURE__*/_wrapRegExp(/(?:^|\s)@?allure\.id[:=]([^\s]+)/, { | ||
var allureMetadataRegexp = exports.allureMetadataRegexp = /*#__PURE__*/_wrapRegExp(/(?:^|\s)@?allure\.(\S+)$/, { | ||
type: 1 | ||
}); | ||
var allureTitleMetadataRegexp = exports.allureTitleMetadataRegexp = /*#__PURE__*/_wrapRegExp(/(?:^|\s)@?allure\.([^:=\s]+)[:=]("[^"]+"|'[^']+'|`[^`]+`|\S+)/, { | ||
type: 1 | ||
}); | ||
var allureTitleMetadataRegexpGlobal = exports.allureTitleMetadataRegexpGlobal = new RegExp(allureTitleMetadataRegexp, "g"); | ||
var allureIdRegexp = exports.allureIdRegexp = /*#__PURE__*/_wrapRegExp(/(?:^|\s)@?allure\.id[:=](\S+)/, { | ||
id: 1 | ||
}); | ||
var allureIdRegexpGlobal = exports.allureIdRegexpGlobal = new RegExp(allureIdRegexp, "g"); | ||
var allureLabelRegexp = exports.allureLabelRegexp = /*#__PURE__*/_wrapRegExp(/(?:^|\s)@?allure\.label\.([^:=\s]+)[:=]([^\s]+)/, { | ||
@@ -86,33 +106,78 @@ name: 1, | ||
}); | ||
var allureLabelRegexpGlobal = exports.allureLabelRegexpGlobal = new RegExp(allureLabelRegexp, "g"); | ||
var getTypeFromAllureTitleMetadataMatch = match => { | ||
return match === null || match === void 0 ? void 0 : match[1]; | ||
}; | ||
exports.getTypeFromAllureTitleMetadataMatch = getTypeFromAllureTitleMetadataMatch; | ||
var getValueFromAllureTitleMetadataMatch = match => { | ||
var _match$; | ||
var quotesRegexp = /['"`]/; | ||
var quoteOpenRegexp = new RegExp("^".concat(quotesRegexp.source)); | ||
var quoteCloseRegexp = new RegExp("".concat(quotesRegexp.source, "$")); | ||
var matchedValue = (_match$ = match === null || match === void 0 ? void 0 : match[2]) !== null && _match$ !== void 0 ? _match$ : ""; | ||
if (quoteOpenRegexp.test(matchedValue) && quoteCloseRegexp.test(matchedValue)) { | ||
return matchedValue.slice(1, -1); | ||
} | ||
return matchedValue; | ||
}; | ||
exports.getValueFromAllureTitleMetadataMatch = getValueFromAllureTitleMetadataMatch; | ||
var isMetadataTag = tag => { | ||
return allureIdRegexp.test(tag) || allureLabelRegexp.test(tag); | ||
return allureMetadataRegexp.test(tag); | ||
}; | ||
exports.isMetadataTag = isMetadataTag; | ||
var getMetadataLabel = (tag, value) => { | ||
var _match$groups; | ||
var match = tag.match(allureMetadataRegexp); | ||
var type = match === null || match === void 0 || (_match$groups = match.groups) === null || _match$groups === void 0 ? void 0 : _match$groups.type; | ||
if (!type) { | ||
return undefined; | ||
} | ||
var [subtype, name] = type.split("."); | ||
return { | ||
name: subtype === "id" ? _model.LabelName.ALLURE_ID : name, | ||
value: value !== null && value !== void 0 ? value : "" | ||
}; | ||
}; | ||
exports.getMetadataLabel = getMetadataLabel; | ||
var extractMetadataFromString = title => { | ||
var labels = []; | ||
title.split(" ").forEach(val => { | ||
var _val$match; | ||
var idValue = (_val$match = val.match(allureIdRegexp)) === null || _val$match === void 0 || (_val$match = _val$match.groups) === null || _val$match === void 0 ? void 0 : _val$match.id; | ||
if (idValue) { | ||
labels.push({ | ||
name: _model.LabelName.ALLURE_ID, | ||
value: idValue | ||
}); | ||
var links = []; | ||
var metadata = title.matchAll(allureTitleMetadataRegexpGlobal); | ||
var cleanTitle = title.replaceAll(allureTitleMetadataRegexpGlobal, "").split(" ").filter(Boolean).reduce((acc, word) => { | ||
if (/^[\n\r]/.test(word)) { | ||
return acc + word; | ||
} | ||
var labelMatch = val.match(allureLabelRegexp); | ||
var { | ||
name, | ||
value | ||
} = (labelMatch === null || labelMatch === void 0 ? void 0 : labelMatch.groups) || {}; | ||
if (name && value) { | ||
labels === null || labels === void 0 || labels.push({ | ||
name, | ||
value | ||
}); | ||
return "".concat(acc, " ").concat(word); | ||
}, "").trim(); | ||
for (var m of metadata) { | ||
var match = m; | ||
var type = getTypeFromAllureTitleMetadataMatch(match); | ||
var value = getValueFromAllureTitleMetadataMatch(match); | ||
if (!type || !value) { | ||
continue; | ||
} | ||
}); | ||
var cleanTitle = title.replace(allureLabelRegexpGlobal, "").replace(allureIdRegexpGlobal, "").trim(); | ||
var [subtype, name] = type.split("."); | ||
switch (subtype) { | ||
case "id": | ||
labels.push({ | ||
name: _model.LabelName.ALLURE_ID, | ||
value | ||
}); | ||
break; | ||
case "label": | ||
labels.push({ | ||
name, | ||
value | ||
}); | ||
break; | ||
case "link": | ||
links.push({ | ||
type: name, | ||
url: value | ||
}); | ||
break; | ||
} | ||
} | ||
return { | ||
labels, | ||
links, | ||
cleanTitle | ||
@@ -119,0 +184,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
export { getStatusFromError, getMessageAndTraceFromError, isMetadataTag, extractMetadataFromString, isAllStepsEnded, isAnyStepFailed, getUnfinishedStepsMessages, hasStepMessage, isPromise, hasLabel, stripAnsi, serialize } from "./utils.js"; | ||
export { getStatusFromError, getMessageAndTraceFromError, isMetadataTag, getMetadataLabel, extractMetadataFromString, isAllStepsEnded, isAnyStepFailed, getUnfinishedStepsMessages, hasStepMessage, isPromise, hasLabel, stripAnsi, serialize } from "./utils.js"; | ||
//# sourceMappingURL=index.js.map |
@@ -84,3 +84,3 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } | ||
links: _links, | ||
globalLabels | ||
globalLabels = {} | ||
} = _ref; | ||
@@ -195,7 +195,2 @@ _defineProperty(this, "state", new LifecycleState()); | ||
this.notifier.beforeTestResultStop(testResult); | ||
(_testResult$testCaseI = testResult.testCaseId) !== null && _testResult$testCaseI !== void 0 ? _testResult$testCaseI : testResult.testCaseId = getTestResultTestCaseId(testResult); | ||
(_testResult$historyId = testResult.historyId) !== null && _testResult$historyId !== void 0 ? _testResult$historyId : testResult.historyId = getTestResultHistoryId(testResult); | ||
var startStop = _classPrivateFieldGet(_calculateTimings, this).call(this, testResult.start, opts === null || opts === void 0 ? void 0 : opts.stop, opts === null || opts === void 0 ? void 0 : opts.duration); | ||
testResult.start = startStop.start; | ||
testResult.stop = startStop.stop; | ||
var scopeUuids = wrapped.scopeUuids; | ||
@@ -223,2 +218,7 @@ scopeUuids.forEach(scopeUuid => { | ||
testResult.labels = [...this.globalLabels, ...testResult.labels]; | ||
(_testResult$testCaseI = testResult.testCaseId) !== null && _testResult$testCaseI !== void 0 ? _testResult$testCaseI : testResult.testCaseId = getTestResultTestCaseId(testResult); | ||
(_testResult$historyId = testResult.historyId) !== null && _testResult$historyId !== void 0 ? _testResult$historyId : testResult.historyId = getTestResultHistoryId(testResult); | ||
var startStop = _classPrivateFieldGet(_calculateTimings, this).call(this, testResult.start, opts === null || opts === void 0 ? void 0 : opts.stop, opts === null || opts === void 0 ? void 0 : opts.duration); | ||
testResult.start = startStop.start; | ||
testResult.stop = startStop.stop; | ||
this.notifier.afterTestResultStop(testResult); | ||
@@ -591,5 +591,21 @@ }); | ||
this.linkConfig = _links; | ||
this.globalLabels = globalLabels !== null && globalLabels !== void 0 ? globalLabels : []; | ||
if (Array.isArray(globalLabels)) { | ||
this.globalLabels = globalLabels; | ||
} else if (Object.keys(globalLabels).length) { | ||
this.globalLabels = Object.entries(globalLabels).flatMap(_ref3 => { | ||
var [name, value] = _ref3; | ||
if (Array.isArray(value)) { | ||
return value.map(v => ({ | ||
name, | ||
value: v | ||
})); | ||
} | ||
return { | ||
name, | ||
value | ||
}; | ||
}); | ||
} | ||
} | ||
} | ||
//# sourceMappingURL=ReporterRuntime.js.map |
@@ -50,2 +50,22 @@ function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)>/g, function (e, r) { var t = o[r]; return "$" + (Array.isArray(t) ? t.join("$") : t); })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); } | ||
}; | ||
var actualAndExpected = value => { | ||
if (!value || typeof value !== "object") { | ||
return {}; | ||
} | ||
// support for jest asserts | ||
if ("matcherResult" in value && value.matcherResult !== undefined && typeof value.matcherResult === "object") { | ||
return { | ||
actual: serialize(value.matcherResult.actual), | ||
expected: serialize(value.matcherResult.expected) | ||
}; | ||
} | ||
var actual = "actual" in value && value.actual !== undefined ? { | ||
actual: serialize(value.actual) | ||
} : {}; | ||
var expected = "expected" in value && value.expected !== undefined ? { | ||
expected: serialize(value.expected) | ||
} : {}; | ||
return _objectSpread(_objectSpread({}, actual), expected); | ||
}; | ||
export var getMessageAndTraceFromError = error => { | ||
@@ -56,17 +76,17 @@ var { | ||
} = error; | ||
var actual = "actual" in error && error.actual !== undefined ? { | ||
actual: serialize(error.actual) | ||
} : {}; | ||
var expected = "expected" in error && error.expected !== undefined ? { | ||
expected: serialize(error.expected) | ||
} : {}; | ||
return _objectSpread(_objectSpread({ | ||
return _objectSpread({ | ||
message: message ? stripAnsi(message) : undefined, | ||
trace: stack ? stripAnsi(stack) : undefined | ||
}, actual), expected); | ||
}, actualAndExpected(error)); | ||
}; | ||
export var allureIdRegexp = /*#__PURE__*/_wrapRegExp(/(?:^|\s)@?allure\.id[:=]([^\s]+)/, { | ||
export var allureMetadataRegexp = /*#__PURE__*/_wrapRegExp(/(?:^|\s)@?allure\.(\S+)$/, { | ||
type: 1 | ||
}); | ||
export var allureTitleMetadataRegexp = /*#__PURE__*/_wrapRegExp(/(?:^|\s)@?allure\.([^:=\s]+)[:=]("[^"]+"|'[^']+'|`[^`]+`|\S+)/, { | ||
type: 1 | ||
}); | ||
export var allureTitleMetadataRegexpGlobal = new RegExp(allureTitleMetadataRegexp, "g"); | ||
export var allureIdRegexp = /*#__PURE__*/_wrapRegExp(/(?:^|\s)@?allure\.id[:=](\S+)/, { | ||
id: 1 | ||
}); | ||
export var allureIdRegexpGlobal = new RegExp(allureIdRegexp, "g"); | ||
export var allureLabelRegexp = /*#__PURE__*/_wrapRegExp(/(?:^|\s)@?allure\.label\.([^:=\s]+)[:=]([^\s]+)/, { | ||
@@ -76,32 +96,74 @@ name: 1, | ||
}); | ||
export var allureLabelRegexpGlobal = new RegExp(allureLabelRegexp, "g"); | ||
export var getTypeFromAllureTitleMetadataMatch = match => { | ||
return match === null || match === void 0 ? void 0 : match[1]; | ||
}; | ||
export var getValueFromAllureTitleMetadataMatch = match => { | ||
var _match$; | ||
var quotesRegexp = /['"`]/; | ||
var quoteOpenRegexp = new RegExp("^".concat(quotesRegexp.source)); | ||
var quoteCloseRegexp = new RegExp("".concat(quotesRegexp.source, "$")); | ||
var matchedValue = (_match$ = match === null || match === void 0 ? void 0 : match[2]) !== null && _match$ !== void 0 ? _match$ : ""; | ||
if (quoteOpenRegexp.test(matchedValue) && quoteCloseRegexp.test(matchedValue)) { | ||
return matchedValue.slice(1, -1); | ||
} | ||
return matchedValue; | ||
}; | ||
export var isMetadataTag = tag => { | ||
return allureIdRegexp.test(tag) || allureLabelRegexp.test(tag); | ||
return allureMetadataRegexp.test(tag); | ||
}; | ||
export var getMetadataLabel = (tag, value) => { | ||
var _match$groups; | ||
var match = tag.match(allureMetadataRegexp); | ||
var type = match === null || match === void 0 || (_match$groups = match.groups) === null || _match$groups === void 0 ? void 0 : _match$groups.type; | ||
if (!type) { | ||
return undefined; | ||
} | ||
var [subtype, name] = type.split("."); | ||
return { | ||
name: subtype === "id" ? LabelName.ALLURE_ID : name, | ||
value: value !== null && value !== void 0 ? value : "" | ||
}; | ||
}; | ||
export var extractMetadataFromString = title => { | ||
var labels = []; | ||
title.split(" ").forEach(val => { | ||
var _val$match; | ||
var idValue = (_val$match = val.match(allureIdRegexp)) === null || _val$match === void 0 || (_val$match = _val$match.groups) === null || _val$match === void 0 ? void 0 : _val$match.id; | ||
if (idValue) { | ||
labels.push({ | ||
name: LabelName.ALLURE_ID, | ||
value: idValue | ||
}); | ||
var links = []; | ||
var metadata = title.matchAll(allureTitleMetadataRegexpGlobal); | ||
var cleanTitle = title.replaceAll(allureTitleMetadataRegexpGlobal, "").split(" ").filter(Boolean).reduce((acc, word) => { | ||
if (/^[\n\r]/.test(word)) { | ||
return acc + word; | ||
} | ||
var labelMatch = val.match(allureLabelRegexp); | ||
var { | ||
name, | ||
value | ||
} = (labelMatch === null || labelMatch === void 0 ? void 0 : labelMatch.groups) || {}; | ||
if (name && value) { | ||
labels === null || labels === void 0 || labels.push({ | ||
name, | ||
value | ||
}); | ||
return "".concat(acc, " ").concat(word); | ||
}, "").trim(); | ||
for (var m of metadata) { | ||
var match = m; | ||
var type = getTypeFromAllureTitleMetadataMatch(match); | ||
var value = getValueFromAllureTitleMetadataMatch(match); | ||
if (!type || !value) { | ||
continue; | ||
} | ||
}); | ||
var cleanTitle = title.replace(allureLabelRegexpGlobal, "").replace(allureIdRegexpGlobal, "").trim(); | ||
var [subtype, name] = type.split("."); | ||
switch (subtype) { | ||
case "id": | ||
labels.push({ | ||
name: LabelName.ALLURE_ID, | ||
value | ||
}); | ||
break; | ||
case "label": | ||
labels.push({ | ||
name, | ||
value | ||
}); | ||
break; | ||
case "link": | ||
links.push({ | ||
type: name, | ||
url: value | ||
}); | ||
break; | ||
} | ||
} | ||
return { | ||
labels, | ||
links, | ||
cleanTitle | ||
@@ -108,0 +170,0 @@ }; |
export type { AllureResults, Category, EnvironmentInfo, ExecutorInfo, RuntimeMessage, RuntimeMetadataMessage, RuntimeAttachmentContentMessage, RuntimeAttachmentPathMessage, RuntimeStartStepMessage, RuntimeStepMetadataMessage, RuntimeStopStepMessage, TestPlanV1Test, TestPlanV1, } from "./types.js"; | ||
export { getStatusFromError, getMessageAndTraceFromError, isMetadataTag, extractMetadataFromString, isAllStepsEnded, isAnyStepFailed, getUnfinishedStepsMessages, hasStepMessage, isPromise, hasLabel, stripAnsi, serialize, } from "./utils.js"; | ||
export { getStatusFromError, getMessageAndTraceFromError, isMetadataTag, getMetadataLabel, extractMetadataFromString, isAllStepsEnded, isAnyStepFailed, getUnfinishedStepsMessages, hasStepMessage, isPromise, hasLabel, stripAnsi, serialize, } from "./utils.js"; |
@@ -15,3 +15,3 @@ /// <reference types="node" /> | ||
globalLabels: Label[]; | ||
constructor({ writer, listeners, environmentInfo, categories, links, globalLabels }: ReporterRuntimeConfig); | ||
constructor({ writer, listeners, environmentInfo, categories, links, globalLabels, }: ReporterRuntimeConfig); | ||
startScope: () => string; | ||
@@ -18,0 +18,0 @@ updateScope: (uuid: string, updateFunc: (scope: TestScope) => void) => void; |
/// <reference types="node" /> | ||
import type { FixtureResult, Label, Link, LinkType, Parameter, StepResult, TestResult, TestResultContainer } from "../../model.js"; | ||
import type { FixtureResult, Label, LabelName, Link, LinkType, Parameter, StepResult, TestResult, TestResultContainer } from "../../model.js"; | ||
import type { Category, EnvironmentInfo } from "../types.js"; | ||
@@ -25,6 +25,7 @@ export declare const ALLURE_METADATA_CONTENT_TYPE = "application/vnd.allure.metadata+json"; | ||
export type WriterDescriptor = [cls: string, ...args: readonly unknown[]] | string; | ||
export type GlobalLabelsConfig = Partial<Record<LabelName, string | string[]>> & Record<string, string | string[]>; | ||
export interface ReporterConfig { | ||
readonly resultsDir?: string; | ||
readonly links?: LinkConfig; | ||
readonly globalLabels?: Label[]; | ||
readonly globalLabels?: Label[] | GlobalLabelsConfig; | ||
readonly listeners?: LifecycleListener[]; | ||
@@ -31,0 +32,0 @@ readonly environmentInfo?: EnvironmentInfo; |
@@ -1,2 +0,2 @@ | ||
import type { FixtureResult, Label, StatusDetails, StepResult, TestResult } from "../model.js"; | ||
import type { FixtureResult, Label, Link, StatusDetails, StepResult, TestResult } from "../model.js"; | ||
import { LabelName, Status } from "../model.js"; | ||
@@ -13,9 +13,23 @@ import type { RuntimeMessage, SerializeOptions } from "./types.js"; | ||
}) => StatusDetails; | ||
type AllureTitleMetadataMatch = RegExpMatchArray & { | ||
groups: { | ||
type?: string; | ||
v1?: string; | ||
v2?: string; | ||
v3?: string; | ||
v4?: string; | ||
}; | ||
}; | ||
export declare const allureMetadataRegexp: RegExp; | ||
export declare const allureTitleMetadataRegexp: RegExp; | ||
export declare const allureTitleMetadataRegexpGlobal: RegExp; | ||
export declare const allureIdRegexp: RegExp; | ||
export declare const allureIdRegexpGlobal: RegExp; | ||
export declare const allureLabelRegexp: RegExp; | ||
export declare const allureLabelRegexpGlobal: RegExp; | ||
export declare const getTypeFromAllureTitleMetadataMatch: (match: AllureTitleMetadataMatch) => string; | ||
export declare const getValueFromAllureTitleMetadataMatch: (match: AllureTitleMetadataMatch) => string; | ||
export declare const isMetadataTag: (tag: string) => boolean; | ||
export declare const getMetadataLabel: (tag: string, value?: string) => Label | undefined; | ||
export declare const extractMetadataFromString: (title: string) => { | ||
labels: Label[]; | ||
links: Link[]; | ||
cleanTitle: string; | ||
@@ -31,1 +45,2 @@ }; | ||
export declare const serialize: (value: any, { maxDepth, maxLength, replacer }?: SerializeOptions) => string; | ||
export {}; |
{ | ||
"name": "allure-js-commons", | ||
"version": "3.0.9", | ||
"version": "3.1.0", | ||
"description": "Allure JS Commons", | ||
@@ -108,3 +108,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"allure-playwright": "3.0.9" | ||
"allure-playwright": "3.1.0" | ||
}, | ||
@@ -111,0 +111,0 @@ "peerDependenciesMeta": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
828401
8256