jest-allure2-adapter
Advanced tools
Comparing version 0.1.9 to 0.1.10
/// <reference types="node" /> | ||
import { Allure, AllureGroup, LinkType, AllureStep, AllureTest, Attachment, Category, ContentType, ExecutableItemWrapper, IAllureConfig, Stage, Status, StepInterface } from 'allure-js-commons'; | ||
import { Allure, AllureGroup, AllureStep, AllureTest, Attachment, Category, ContentType, ExecutableItemWrapper, IAllureConfig, LinkType, Stage, Status, StepInterface, Severity } from 'allure-js-commons'; | ||
export declare class AllureReporter extends Allure { | ||
@@ -21,2 +21,3 @@ private runningTest; | ||
endStep(status?: Status, stage?: Stage): void; | ||
endSteps(): void; | ||
endTest(spec: any): void; | ||
@@ -41,4 +42,2 @@ get currentStep(): AllureStep | null; | ||
addTestPathParameter(relativeFrom: string, spec: any): this; | ||
description(description: string): this; | ||
descriptionHtml(description: string): this; | ||
addLink(options: { | ||
@@ -62,2 +61,9 @@ name?: string; | ||
addLabel(name: string, value: string): this; | ||
description(description: string): this; | ||
descriptionHtml(description: string): this; | ||
feature(feature: string): void; | ||
story(story: string): void; | ||
tag(tag: string): void; | ||
owner(owner: string): void; | ||
severity(severity: Severity): void; | ||
} |
@@ -66,5 +66,3 @@ "use strict"; | ||
startTest(name) { | ||
// const newName = name?.replace('#tag', ''); | ||
this.runningTest = this.currentGroup.startTest(name); | ||
// this.tag('#tag'); | ||
// Capture Jest worker thread for timeline report | ||
@@ -98,4 +96,13 @@ if (process.env.JEST_WORKER_ID) { | ||
} | ||
endSteps() { | ||
while (this.currentStep !== null) { | ||
this.endStep(allure_js_commons_1.Status.BROKEN); | ||
} | ||
/*for(let step of this.stepStack){ | ||
this.endStep(Status.BROKEN); | ||
}*/ | ||
} | ||
// todo type | ||
endTest(spec) { | ||
this.endSteps(); | ||
if (spec.status === SpecStatus.PASSED) { | ||
@@ -148,2 +155,3 @@ this.currentTest.status = allure_js_commons_1.Status.PASSED; | ||
const groups = this.groupNameStack; | ||
this.addPackage(groups.join('.')); | ||
if (groups.length > 0) { | ||
@@ -156,4 +164,8 @@ this.parentSuite(groups[0]); | ||
if (groups.length > 2) { | ||
this.subSuite(groups.slice(2).join(' > ')); | ||
this.subSuite(groups[2]); | ||
} | ||
if (groups.length > 3) { | ||
// todo: addition to test name | ||
// this.subSuite(groups.slice(3).join(' > ')); | ||
} | ||
} | ||
@@ -191,3 +203,2 @@ endGroup() { | ||
step(name, body, ...args) { | ||
console.log('step:', name); | ||
const allureStep = this.startStep(name); | ||
@@ -203,3 +214,2 @@ let result; | ||
catch (error) { | ||
console.log('Result:' + JSON.stringify(result)); | ||
this.endStep(allure_js_commons_1.Status.FAILED); | ||
@@ -212,3 +222,2 @@ throw error; | ||
.then((a) => { | ||
console.log('Result pass: isPromise'); | ||
this.endStep(allure_js_commons_1.Status.PASSED); | ||
@@ -227,5 +236,2 @@ return a; | ||
} | ||
/*if (!isPromise(result)) { | ||
}*/ | ||
} | ||
@@ -241,3 +247,3 @@ addEnvironment(name, value) { | ||
logStep(name, status, attachments) { | ||
console.log('AllureImpl status:', status); | ||
// console.log('AllureImpl status:', status); | ||
/*const wrappedStep = this.startStep(name); | ||
@@ -291,10 +297,2 @@ | ||
} | ||
description(description) { | ||
this.currentTest.description = description; | ||
return this; | ||
} | ||
descriptionHtml(description) { | ||
this.currentTest.descriptionHtml = description; | ||
return this; | ||
} | ||
addLink(options) { | ||
@@ -306,21 +304,22 @@ var _a; | ||
addIssue(options) { | ||
var _a; | ||
const uri = 'some'; | ||
var _a, _b; | ||
// todo config | ||
/* options.url ?? | ||
(this.config?.issueUri ? this.config.issueUri(options.id) : undefined);*/ | ||
if (!uri) { | ||
throw new Error('Specify url or issueUri in config'); | ||
} | ||
this.issue((_a = options.name) !== null && _a !== void 0 ? _a : options.id, uri); | ||
/*if (!url) { | ||
throw new Error('Specify url or issueUri in config'); | ||
}*/ | ||
this.issue((_a = options.name) !== null && _a !== void 0 ? _a : options.id, (_b = options.url) !== null && _b !== void 0 ? _b : options.id); | ||
return this; | ||
} | ||
addTms(options) { | ||
var _a; | ||
const uri = 'some'; | ||
var _a, _b; | ||
// todo config | ||
// const uri = 'some'; | ||
/* options.url ?? | ||
(this.config?.tmsUri ? this.config.tmsUri(options.id) : undefined);*/ | ||
if (!uri) { | ||
throw new Error('Specify url or tmsUri in config'); | ||
} | ||
this.tms((_a = options.name) !== null && _a !== void 0 ? _a : options.id, uri); | ||
/*if (!uri) { | ||
throw new Error('Specify url or tmsUri in config'); | ||
}*/ | ||
this.tms((_a = options.name) !== null && _a !== void 0 ? _a : options.id, (_b = options.url) !== null && _b !== void 0 ? _b : options.id); | ||
return this; | ||
@@ -340,3 +339,26 @@ } | ||
} | ||
description(description) { | ||
this.currentTest.description = description; | ||
return this; | ||
} | ||
descriptionHtml(description) { | ||
this.currentTest.descriptionHtml = description; | ||
return this; | ||
} | ||
feature(feature) { | ||
super.feature(feature); | ||
} | ||
story(story) { | ||
super.story(story); | ||
} | ||
tag(tag) { | ||
super.tag(tag); | ||
} | ||
owner(owner) { | ||
super.owner(owner); | ||
} | ||
severity(severity) { | ||
super.severity(severity); | ||
} | ||
} | ||
exports.AllureReporter = AllureReporter; |
@@ -23,5 +23,4 @@ import { AllureReporter } from './AllureReporter'; | ||
export declare function registerAllureReporter(): void; | ||
export declare function addReporter(jasmineCustom?: (r: AllureReporter) => jasmine.CustomReporter): void; | ||
declare global { | ||
export const reporter: AllureReporter; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.addReporter = exports.registerAllureReporter = void 0; | ||
exports.registerAllureReporter = void 0; | ||
const AllureReporter_1 = require("./AllureReporter"); | ||
const JasmineAllureReporter_1 = require("./JasmineAllureReporter"); | ||
function registerAllureReporter() { | ||
global.reporter = new AllureReporter_1.AllureReporter(); | ||
// (jasmine as any).getEnv().addReporter(new JasmineAllureReporter(reporter)); | ||
const reporter = (global.reporter = new AllureReporter_1.AllureReporter()); | ||
jasmine.getEnv().addReporter(new JasmineAllureReporter_1.JasmineAllureReporter(reporter)); | ||
} | ||
exports.registerAllureReporter = registerAllureReporter; | ||
function addReporter(jasmineCustom) { | ||
// const reporter = ((global as any).reporter = new AllureReporter()); | ||
jasmine | ||
.getEnv() | ||
.addReporter(jasmineCustom !== null && jasmineCustom !== void 0 ? jasmineCustom : new JasmineAllureReporter_1.JasmineAllureReporter(reporter)); | ||
/* | ||
export function addReporter( | ||
jasmineCustom?: (r: AllureReporter) => jasmine.CustomReporter, | ||
) { | ||
// const reporter = ((global as any).reporter = new AllureReporter()); | ||
jasmine | ||
.getEnv() | ||
.addReporter(jasmineCustom ?? new JasmineAllureReporter(reporter)); | ||
} | ||
exports.addReporter = addReporter; | ||
*/ | ||
registerAllureReporter(); |
{ | ||
"name": "jest-allure2-adapter", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "Allure 2 Adapter for jest", | ||
@@ -5,0 +5,0 @@ "main": "dist/index", |
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
34234
919