allure-js-commons
Advanced tools
Comparing version 2.0.0-beta.8 to 2.0.0-beta.9
@@ -10,2 +10,2 @@ export { AllureRuntime } from "./src/AllureRuntime"; | ||
export { Allure, StepInterface } from "./src/Allure"; | ||
export { Attachment, Category, StepResult, Parameter, StatusDetails, Link, Label, ExecutorInfo, TestResultContainer, FixtureResult, TestResult, ContentType, LabelName, Severity, Stage, Status, LinkType } from "./src/model"; | ||
export { AttachmentOptions, Attachment, Category, StepResult, Parameter, StatusDetails, Link, Label, ExecutorInfo, TestResultContainer, FixtureResult, TestResult, ContentType, LabelName, Severity, Stage, Status, LinkType } from "./src/model"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LinkType = exports.Status = exports.Stage = exports.Severity = exports.LabelName = exports.ContentType = exports.Allure = exports.isPromise = exports.AllureStep = exports.AllureTest = exports.ExecutableItemWrapper = exports.AllureGroup = exports.AllureConfig = exports.InMemoryAllureWriter = exports.AllureRuntime = void 0; | ||
var AllureRuntime_1 = require("./src/AllureRuntime"); | ||
@@ -4,0 +5,0 @@ Object.defineProperty(exports, "AllureRuntime", { enumerable: true, get: function () { return AllureRuntime_1.AllureRuntime; } }); |
/// <reference types="node" /> | ||
import { Category, Status } from "./model"; | ||
import { AttachmentOptions, Category, Status } from "./model"; | ||
import { ContentType } from "./model"; | ||
@@ -25,3 +25,3 @@ import { AllureTest } from "./AllureTest"; | ||
descriptionHtml(html: string): void; | ||
abstract attachment(name: string, content: Buffer | string, type: ContentType): void; | ||
abstract attachment(name: string, content: Buffer | string, options: ContentType | string | AttachmentOptions): void; | ||
owner(owner: string): void; | ||
@@ -28,0 +28,0 @@ severity(severity: string): void; |
/// <reference types="node" /> | ||
import { Category, ContentType, TestResult, TestResultContainer } from "./model"; | ||
import { AttachmentOptions, Category, ContentType, TestResult, TestResultContainer } from "./model"; | ||
import { IAllureConfig } from "./AllureConfig"; | ||
@@ -12,5 +12,5 @@ import { AllureGroup } from "./AllureGroup"; | ||
writeGroup(result: TestResultContainer): void; | ||
writeAttachment(content: Buffer | string, contentType: ContentType): string; | ||
writeAttachment(content: Buffer | string, options: ContentType | string | AttachmentOptions): string; | ||
writeEnvironmentInfo(info?: Record<string, string>): void; | ||
writeCategoriesDefinitions(categories: Category[]): void; | ||
} |
@@ -26,4 +26,7 @@ "use strict"; | ||
} | ||
writeAttachment(content, contentType) { | ||
const extension = writers_1.typeToExtension(contentType); | ||
writeAttachment(content, options) { | ||
if (typeof options === "string") { | ||
options = { contentType: options }; | ||
} | ||
const extension = writers_1.typeToExtension(options); | ||
const fileName = `${uuid_1.v4()}-attachment.${extension}`; | ||
@@ -30,0 +33,0 @@ this.writer.writeAttachment(fileName, content); |
@@ -1,2 +0,2 @@ | ||
import { StatusDetails, StepResult, FixtureResult, TestResult, Status, Stage, ContentType } from "./model"; | ||
import { AttachmentOptions, StatusDetails, StepResult, FixtureResult, TestResult, Status, Stage, ContentType } from "./model"; | ||
export declare class ExecutableItemWrapper { | ||
@@ -16,3 +16,3 @@ private readonly info; | ||
addParameter(name: string, value: string): void; | ||
addAttachment(name: string, type: ContentType, fileName: string): void; | ||
addAttachment(name: string, options: ContentType | string | AttachmentOptions, fileName: string): void; | ||
startStep(name: string, start?: number): AllureStep; | ||
@@ -19,0 +19,0 @@ wrap<T>(fun: (...args: any[]) => any): (...args: any[]) => any; |
@@ -44,4 +44,7 @@ "use strict"; | ||
} | ||
addAttachment(name, type, fileName) { | ||
this.info.attachments.push({ name, type, source: fileName }); | ||
addAttachment(name, options, fileName) { | ||
if (typeof options === "string") { | ||
options = { contentType: options }; | ||
} | ||
this.info.attachments.push({ name, type: options.contentType, source: fileName }); | ||
} | ||
@@ -48,0 +51,0 @@ startStep(name, start) { |
@@ -6,2 +6,6 @@ export interface Attachment { | ||
} | ||
export interface AttachmentOptions { | ||
contentType: ContentType | string; | ||
fileExtension?: string; | ||
} | ||
export interface Label { | ||
@@ -8,0 +12,0 @@ name: LabelName | string; |
@@ -10,5 +10,6 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.InMemoryAllureWriter = exports.AllureWriter = void 0; | ||
var AllureWriter_1 = require("./AllureWriter"); | ||
@@ -15,0 +16,0 @@ Object.defineProperty(exports, "AllureWriter", { enumerable: true, get: function () { return AllureWriter_1.AllureWriter; } }); |
@@ -1,2 +0,2 @@ | ||
import { ContentType } from "../model"; | ||
export declare function typeToExtension(type: ContentType): string; | ||
import { AttachmentOptions } from "../model"; | ||
export declare function typeToExtension(options: AttachmentOptions): string; |
@@ -5,4 +5,7 @@ "use strict"; | ||
const model_1 = require("../model"); | ||
function typeToExtension(type) { | ||
switch (type) { | ||
function typeToExtension(options) { | ||
if (options.fileExtension) { | ||
return options.fileExtension; | ||
} | ||
switch (options.contentType) { | ||
case model_1.ContentType.TEXT: | ||
@@ -31,5 +34,5 @@ return "txt"; | ||
} | ||
throw new Error(`Unrecognized extension: ${type}`); | ||
throw new Error(`Unrecognized extension: ${options.contentType}`); | ||
} | ||
exports.typeToExtension = typeToExtension; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "allure-js-commons", | ||
"version": "2.0.0-beta.8", | ||
"version": "2.0.0-beta.9", | ||
"description": "Allure JS Commons", | ||
@@ -27,3 +27,3 @@ "license": "Apache-2.0", | ||
}, | ||
"gitHead": "96cb18546ac2ad3797beb1ce51d7f45ef5a0676c" | ||
"gitHead": "2debbad94a8a7c5d8c88f74413ec44433a4664a8" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64949
953