allure-js-commons
Advanced tools
Comparing version 2.0.0-beta.3 to 2.0.0-beta.4
export { AllureRuntime } from "./src/AllureRuntime"; | ||
export { ContentType } from "./src/entities/ContentType"; | ||
export { LabelName } from "./src/entities/LabelName"; | ||
export { Status } from "./src/entities/Status"; | ||
export { Stage } from "./src/entities/Stage"; | ||
export { Severity } from "./src/entities/Severity"; | ||
export { AllureConfig, IAllureConfig } from "./src/AllureConfig"; | ||
@@ -11,8 +6,8 @@ export { AllureGroup } from "./src/AllureGroup"; | ||
export { AllureTest } from "./src/AllureTest"; | ||
export { TestResult } from "./src/entities/TestResult"; | ||
export { AllureStep } from "./src/ExecutableItemWrapper"; | ||
export { isPromise } from "./src/isPromise"; | ||
export { AllureInterface } from "./src/AllureInterface"; | ||
export { Allure, StepInterface } from "./src/Allure"; | ||
export { GlobalInfoWriter } from "./src/GlobalInfoWriter"; | ||
export { ExecutorInfo } from "./src/entities/ExecutorInfo"; | ||
export { Category } from "./src/entities/Category"; | ||
export { Attachment, Category, StepResult, Parameter, StatusDetails, Link, Label, ExecutorInfo, TestResultContainer, FixtureResult, TestResult, ContentType, LabelName, Severity, Stage, Status, LinkType } from "./src/model"; | ||
export { InMemoryAllureRuntime } from "./src/InMemoryAllureRuntime"; | ||
export { IAllureRuntime } from "./src/IAllureRuntime"; |
@@ -1,2 +0,2 @@ | ||
import { TestResult } from "./entities/TestResult"; | ||
import { TestResult } from "./model"; | ||
export interface IAllureConfig { | ||
@@ -3,0 +3,0 @@ readonly resultsDir: string; |
@@ -1,9 +0,8 @@ | ||
import { AllureRuntime } from "./AllureRuntime"; | ||
import { ExecutableItemWrapper } from "./ExecutableItemWrapper"; | ||
import { AllureTest } from "./AllureTest"; | ||
import { IAllureRuntime } from "./IAllureRuntime"; | ||
export declare class AllureGroup { | ||
private readonly runtime; | ||
private readonly parent?; | ||
private testResultContainer; | ||
constructor(runtime: AllureRuntime, parent?: AllureGroup | undefined); | ||
constructor(runtime: IAllureRuntime); | ||
startGroup(name?: string): AllureGroup; | ||
@@ -14,7 +13,4 @@ startTest(name?: string): AllureTest; | ||
name: string; | ||
description: string; | ||
descriptionHtml: string; | ||
addLink(name: string, url: string, type?: string): void; | ||
addBefore(): ExecutableItemWrapper; | ||
addAfter(): ExecutableItemWrapper; | ||
} |
/// <reference types="node" /> | ||
import { TestResult } from "./entities/TestResult"; | ||
import { TestResultContainer } from "./entities/TestResultContainer"; | ||
import { ContentType } from "./entities/ContentType"; | ||
import { ExecutorInfo } from "./entities/ExecutorInfo"; | ||
import { Category } from "./entities/Category"; | ||
import { Category, ContentType, ExecutorInfo, TestResult, TestResultContainer } from "./model"; | ||
import { IAllureConfig } from "./AllureConfig"; | ||
import { AllureGroup } from "./AllureGroup"; | ||
import { GlobalInfoWriter } from "./GlobalInfoWriter"; | ||
export declare class AllureRuntime implements GlobalInfoWriter { | ||
import { IAllureRuntime } from "./IAllureRuntime"; | ||
export declare class AllureRuntime implements IAllureRuntime { | ||
private config; | ||
@@ -12,0 +8,0 @@ constructor(config: IAllureConfig); |
import { ExecutableItemWrapper } from "./ExecutableItemWrapper"; | ||
import { AllureGroup } from "./AllureGroup"; | ||
import { AllureRuntime } from "./AllureRuntime"; | ||
import { IAllureRuntime } from "./IAllureRuntime"; | ||
export declare class AllureTest extends ExecutableItemWrapper { | ||
private readonly runtime; | ||
private readonly parent?; | ||
private testResult; | ||
constructor(runtime: AllureRuntime, parent?: AllureGroup | undefined); | ||
private readonly testResult; | ||
constructor(runtime: IAllureRuntime); | ||
endTest(): void; | ||
@@ -14,3 +12,3 @@ readonly uuid: string; | ||
addLabel(name: string, value: string): void; | ||
addLink(name: string, url: string, type?: string): void; | ||
addLink(url: string, name?: string, type?: string): void; | ||
} |
@@ -1,11 +0,6 @@ | ||
import { ExecutableItem } from "./entities/ExecutableItem"; | ||
import { Status } from "./entities/Status"; | ||
import { StatusDetails } from "./entities/StatusDetails"; | ||
import { Stage } from "./entities/Stage"; | ||
import { ContentType } from "./entities/ContentType"; | ||
import { StepResult } from "./entities/StepResult"; | ||
import { StatusDetails, StepResult, FixtureResult, TestResult, Status, Stage, ContentType } from "./model"; | ||
export declare class ExecutableItemWrapper { | ||
private readonly info; | ||
constructor(info: ExecutableItem); | ||
protected readonly wrappedItem: ExecutableItem; | ||
constructor(info: FixtureResult | TestResult); | ||
protected readonly wrappedItem: FixtureResult | TestResult; | ||
name: string; | ||
@@ -18,5 +13,2 @@ description: string; | ||
detailsTrace: string; | ||
detailsMuted: boolean; | ||
detailsKnown: boolean; | ||
detailsFlaky: boolean; | ||
stage: Stage; | ||
@@ -23,0 +15,0 @@ addParameter(name: string, value: string): void; |
@@ -1,3 +0,2 @@ | ||
import { ExecutorInfo } from "./entities/ExecutorInfo"; | ||
import { Category } from "./entities/Category"; | ||
import { ExecutorInfo, Category } from "./model"; | ||
export interface GlobalInfoWriter { | ||
@@ -4,0 +3,0 @@ writeExecutorInfo(info: ExecutorInfo): void; |
@@ -5,12 +5,2 @@ "use strict"; | ||
exports.AllureRuntime = AllureRuntime_1.AllureRuntime; | ||
var ContentType_1 = require("./src/entities/ContentType"); | ||
exports.ContentType = ContentType_1.ContentType; | ||
var LabelName_1 = require("./src/entities/LabelName"); | ||
exports.LabelName = LabelName_1.LabelName; | ||
var Status_1 = require("./src/entities/Status"); | ||
exports.Status = Status_1.Status; | ||
var Stage_1 = require("./src/entities/Stage"); | ||
exports.Stage = Stage_1.Stage; | ||
var Severity_1 = require("./src/entities/Severity"); | ||
exports.Severity = Severity_1.Severity; | ||
var AllureConfig_1 = require("./src/AllureConfig"); | ||
@@ -24,4 +14,2 @@ exports.AllureConfig = AllureConfig_1.AllureConfig; | ||
exports.AllureTest = AllureTest_1.AllureTest; | ||
var TestResult_1 = require("./src/entities/TestResult"); | ||
exports.TestResult = TestResult_1.TestResult; | ||
var ExecutableItemWrapper_2 = require("./src/ExecutableItemWrapper"); | ||
@@ -31,8 +19,13 @@ exports.AllureStep = ExecutableItemWrapper_2.AllureStep; | ||
exports.isPromise = isPromise_1.isPromise; | ||
var AllureInterface_1 = require("./src/AllureInterface"); | ||
exports.AllureInterface = AllureInterface_1.AllureInterface; | ||
var ExecutorInfo_1 = require("./src/entities/ExecutorInfo"); | ||
exports.ExecutorInfo = ExecutorInfo_1.ExecutorInfo; | ||
var Category_1 = require("./src/entities/Category"); | ||
exports.Category = Category_1.Category; | ||
var Allure_1 = require("./src/Allure"); | ||
exports.Allure = Allure_1.Allure; | ||
var model_1 = require("./src/model"); | ||
exports.ContentType = model_1.ContentType; | ||
exports.LabelName = model_1.LabelName; | ||
exports.Severity = model_1.Severity; | ||
exports.Stage = model_1.Stage; | ||
exports.Status = model_1.Status; | ||
exports.LinkType = model_1.LinkType; | ||
var InMemoryAllureRuntime_1 = require("./src/InMemoryAllureRuntime"); | ||
exports.InMemoryAllureRuntime = InMemoryAllureRuntime_1.InMemoryAllureRuntime; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const TestResultContainer_1 = require("./entities/TestResultContainer"); | ||
const Link_1 = require("./entities/Link"); | ||
const ExecutableItem_1 = require("./entities/ExecutableItem"); | ||
const ExecutableItemWrapper_1 = require("./ExecutableItemWrapper"); | ||
const AllureTest_1 = require("./AllureTest"); | ||
const constructors_1 = require("./constructors"); | ||
class AllureGroup { | ||
constructor(runtime, parent) { | ||
constructor(runtime) { | ||
this.runtime = runtime; | ||
this.parent = parent; | ||
this.testResultContainer = new TestResultContainer_1.TestResultContainer(); | ||
this.testResultContainer.start = Date.now(); | ||
this.testResultContainer = constructors_1.testResultContainer(); | ||
} | ||
startGroup(name) { | ||
const group = new AllureGroup(this.runtime, this); | ||
const group = new AllureGroup(this.runtime); | ||
this.testResultContainer.children.push(group.uuid); | ||
@@ -22,3 +18,3 @@ group.name = name || "Unnamed"; | ||
startTest(name) { | ||
const test = new AllureTest_1.AllureTest(this.runtime, this); | ||
const test = new AllureTest_1.AllureTest(this.runtime); | ||
this.testResultContainer.children.push(test.uuid); | ||
@@ -29,3 +25,2 @@ test.name = name || "Unnamed"; | ||
endGroup() { | ||
this.testResultContainer.stop = Date.now(); | ||
this.runtime.writeGroup(this.testResultContainer); | ||
@@ -42,13 +37,4 @@ } | ||
} | ||
set description(description) { | ||
this.testResultContainer.description = description; | ||
} | ||
set descriptionHtml(descriptionHtml) { | ||
this.testResultContainer.descriptionHtml = descriptionHtml; | ||
} | ||
addLink(name, url, type) { | ||
this.testResultContainer.links.push(new Link_1.Link(name, url, type)); | ||
} | ||
addBefore() { | ||
const result = new ExecutableItem_1.ExecutableItem(); | ||
const result = constructors_1.fixtureResult(); | ||
this.testResultContainer.befores.push(result); | ||
@@ -58,3 +44,3 @@ return new ExecutableItemWrapper_1.ExecutableItemWrapper(result); | ||
addAfter() { | ||
const result = new ExecutableItem_1.ExecutableItem(); | ||
const result = constructors_1.fixtureResult(); | ||
this.testResultContainer.afters.push(result); | ||
@@ -61,0 +47,0 @@ return new ExecutableItemWrapper_1.ExecutableItemWrapper(result); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const model_1 = require("./model"); | ||
const fs_1 = require("fs"); | ||
@@ -8,9 +9,36 @@ const mkdirp_1 = require("mkdirp"); | ||
const properties_1 = require("properties"); | ||
const ContentType_1 = require("./entities/ContentType"); | ||
const AllureGroup_1 = require("./AllureGroup"); | ||
function typeToExtension(type) { | ||
switch (type) { | ||
case model_1.ContentType.TEXT: | ||
return "txt"; | ||
case model_1.ContentType.XML: | ||
return "xml"; | ||
case model_1.ContentType.CSV: | ||
return "csv"; | ||
case model_1.ContentType.TSV: | ||
return "tsv"; | ||
case model_1.ContentType.CSS: | ||
return "css"; | ||
case model_1.ContentType.URI: | ||
return "uri"; | ||
case model_1.ContentType.SVG: | ||
return "svg"; | ||
case model_1.ContentType.PNG: | ||
return "png"; | ||
case model_1.ContentType.JSON: | ||
return "json"; | ||
case model_1.ContentType.WEBM: | ||
return "webm"; | ||
case model_1.ContentType.JPEG: | ||
return "jpg"; | ||
} | ||
throw new Error(`Unrecognized extension: ${type}`); | ||
} | ||
class AllureRuntime { | ||
constructor(config) { | ||
this.config = config; | ||
if (!fs_1.existsSync(this.config.resultsDir)) | ||
if (!fs_1.existsSync(this.config.resultsDir)) { | ||
mkdirp_1.sync(this.config.resultsDir); | ||
} | ||
} | ||
@@ -34,3 +62,3 @@ startGroup(name) { | ||
writeAttachment(content, contentType) { | ||
const extension = ContentType_1.typeToExtension(contentType); | ||
const extension = typeToExtension(contentType); | ||
const fileName = `${uuid_1.v4()}-attachment.${extension}`; | ||
@@ -37,0 +65,0 @@ const path = path_1.join(this.config.resultsDir, fileName); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ExecutableItemWrapper_1 = require("./ExecutableItemWrapper"); | ||
const TestResult_1 = require("./entities/TestResult"); | ||
const Label_1 = require("./entities/Label"); | ||
const Link_1 = require("./entities/Link"); | ||
const constructors_1 = require("./constructors"); | ||
class AllureTest extends ExecutableItemWrapper_1.ExecutableItemWrapper { | ||
constructor(runtime, parent) { | ||
super(new TestResult_1.TestResult()); | ||
constructor(runtime) { | ||
super(constructors_1.testResult()); | ||
this.runtime = runtime; | ||
this.parent = parent; | ||
this.testResult = this.wrappedItem; | ||
@@ -29,6 +26,6 @@ this.testResult.start = Date.now(); | ||
addLabel(name, value) { | ||
this.testResult.labels.push(new Label_1.Label(name, value)); | ||
this.testResult.labels.push({ name, value }); | ||
} | ||
addLink(name, url, type) { | ||
this.testResult.links.push(new Link_1.Link(name, url, type)); | ||
addLink(url, name, type) { | ||
this.testResult.links.push({ name, url, type }); | ||
} | ||
@@ -35,0 +32,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ExecutableItem_1 = require("./entities/ExecutableItem"); | ||
const Status_1 = require("./entities/Status"); | ||
const Stage_1 = require("./entities/Stage"); | ||
const Parameter_1 = require("./entities/Parameter"); | ||
const Attachment_1 = require("./entities/Attachment"); | ||
const model_1 = require("./model"); | ||
const isPromise_1 = require("./isPromise"); | ||
const constructors_1 = require("./constructors"); | ||
class ExecutableItemWrapper { | ||
@@ -37,11 +34,2 @@ constructor(info) { | ||
} | ||
set detailsMuted(muted) { | ||
this.info.statusDetails.muted = muted; | ||
} | ||
set detailsKnown(known) { | ||
this.info.statusDetails.known = known; | ||
} | ||
set detailsFlaky(flaky) { | ||
this.info.statusDetails.flaky = flaky; | ||
} | ||
set stage(stage) { | ||
@@ -51,11 +39,11 @@ this.info.stage = stage; | ||
addParameter(name, value) { | ||
this.info.parameters.push(new Parameter_1.Parameter(name, value)); | ||
this.info.parameters.push({ name, value }); | ||
} | ||
addAttachment(name, type, fileName) { | ||
this.info.attachments.push(new Attachment_1.Attachment(name, type, fileName)); | ||
this.info.attachments.push({ name, type, source: fileName }); | ||
} | ||
startStep(name) { | ||
const stepResult = new ExecutableItem_1.ExecutableItem(); | ||
this.info.steps.push(stepResult); | ||
const allureStep = new AllureStep(stepResult); | ||
const result = constructors_1.stepResult(); | ||
this.info.steps.push(result); | ||
const allureStep = new AllureStep(result); | ||
allureStep.name = name; | ||
@@ -66,3 +54,3 @@ return allureStep; | ||
return (...args) => { | ||
this.stage = Stage_1.Stage.RUNNING; | ||
this.stage = model_1.Stage.RUNNING; | ||
let result; | ||
@@ -73,4 +61,4 @@ try { | ||
catch (error) { | ||
this.stage = Stage_1.Stage.INTERRUPTED; | ||
this.status = Status_1.Status.BROKEN; | ||
this.stage = model_1.Stage.INTERRUPTED; | ||
this.status = model_1.Status.BROKEN; | ||
if (error) { | ||
@@ -85,8 +73,8 @@ this.detailsMessage = error.message || ""; | ||
return promise.then(res => { | ||
this.status = Status_1.Status.PASSED; | ||
this.stage = Stage_1.Stage.FINISHED; | ||
this.status = model_1.Status.PASSED; | ||
this.stage = model_1.Stage.FINISHED; | ||
return res; | ||
}).catch(error => { | ||
this.stage = Stage_1.Stage.INTERRUPTED; | ||
this.status = Status_1.Status.BROKEN; | ||
this.stage = model_1.Stage.INTERRUPTED; | ||
this.status = model_1.Status.BROKEN; | ||
if (error) { | ||
@@ -100,4 +88,4 @@ this.detailsMessage = error.message || ""; | ||
else { | ||
this.status = Status_1.Status.PASSED; | ||
this.stage = Stage_1.Stage.FINISHED; | ||
this.status = model_1.Status.PASSED; | ||
this.stage = model_1.Stage.FINISHED; | ||
return result; | ||
@@ -104,0 +92,0 @@ } |
{ | ||
"name": "allure-js-commons", | ||
"version": "2.0.0-beta.3", | ||
"version": "2.0.0-beta.4", | ||
"description": "Allure JS Commons", | ||
@@ -27,3 +27,3 @@ "license": "Apache-2.0", | ||
}, | ||
"gitHead": "600e5dacbc6587d3d2994b26c44e5dbf2e6f2099" | ||
"gitHead": "8dfa461802b3e82dcdcac7714edef9a5f810368b" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
57676
42
854
1