UNPKG

jest-allure2-reporter

Version:
24 lines 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FileAttachment = FileAttachment; 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 FileAttachment(name, mimeType) { function FileAttachmentDecorator(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.createFileAttachment(originalFunction, options); if (descriptor) { descriptor.value = wrappedFunction; } else { return wrappedFunction; } } return FileAttachmentDecorator; } //# sourceMappingURL=FileAttachment.js.map