jest-allure2-reporter
Version:
Idiomatic Jest reporter for Allure Framework
25 lines • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Attachment = Attachment;
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 Attachment(name, mimeType) {
utils_1.typeAssertions.assertNotNullish(name, 'name string or options');
function AttachmentDecorator(maybeTarget, _maybeKey, maybeDescriptor) {
const descriptor = maybeDescriptor;
const originalFunction = descriptor?.value ?? maybeTarget;
utils_1.typeAssertions.assertFunction(originalFunction, 'class method to decorate');
const options = typeof name === 'string' ? { name, mimeType } : name;
const wrappedFunction = allure.createAttachment(originalFunction, options);
if (descriptor) {
descriptor.value = wrappedFunction;
}
else {
return wrappedFunction;
}
}
return AttachmentDecorator;
}
//# sourceMappingURL=Attachment.js.map