jest-allure2-reporter
Version:
Idiomatic Jest reporter for Allure Framework
28 lines • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Step = Step;
const tslib_1 = require("tslib");
const realms_1 = tslib_1.__importDefault(require("../../realms"));
const utils_1 = require("../../utils");
const allure = realms_1.default.runtime;
function Step(name, arguments_) {
if (arguments_ !== undefined) {
utils_1.typeAssertions.assertArray(arguments_, 'arguments');
}
function StepDecorator(maybeTarget, _maybeKey, maybeDescriptor) {
const descriptor = maybeDescriptor;
const originalFunction = descriptor?.value ?? maybeTarget;
utils_1.typeAssertions.assertFunction(originalFunction, 'class method to decorate');
const wrappedFunction = arguments_ === undefined
? allure.createStep(name, originalFunction)
: allure.createStep(name, arguments_, originalFunction);
if (descriptor) {
descriptor.value = wrappedFunction;
}
else {
return wrappedFunction;
}
}
return StepDecorator;
}
//# sourceMappingURL=Step.js.map