allure-jasmine
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-beta.3
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var allure_js_commons_1 = require("allure-js-commons"); | ||
const allure_js_commons_1 = require("allure-js-commons"); | ||
var SpecStatus; | ||
@@ -26,4 +13,4 @@ (function (SpecStatus) { | ||
})(SpecStatus || (SpecStatus = {})); | ||
var JasmineAllureReporter = (function () { | ||
function JasmineAllureReporter(runtime) { | ||
class JasmineAllureReporter { | ||
constructor(runtime) { | ||
this.runtime = runtime; | ||
@@ -36,51 +23,39 @@ this.groupStack = []; | ||
} | ||
JasmineAllureReporter.prototype.getCurrentGroup = function () { | ||
getCurrentGroup() { | ||
if (this.groupStack.length === 0) | ||
return null; | ||
return this.groupStack[this.groupStack.length - 1]; | ||
}; | ||
Object.defineProperty(JasmineAllureReporter.prototype, "currentGroup", { | ||
get: function () { | ||
var currentGroup = this.getCurrentGroup(); | ||
if (currentGroup === null) | ||
throw new Error("No active group"); | ||
return currentGroup; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
JasmineAllureReporter.prototype.getInterface = function () { | ||
} | ||
get currentGroup() { | ||
const currentGroup = this.getCurrentGroup(); | ||
if (currentGroup === null) | ||
throw new Error("No active group"); | ||
return currentGroup; | ||
} | ||
getInterface() { | ||
return new JasmineAllureInterface(this); | ||
}; | ||
JasmineAllureReporter.prototype.getGlobalInfoWriter = function () { | ||
} | ||
getGlobalInfoWriter() { | ||
return this.runtime; | ||
}; | ||
Object.defineProperty(JasmineAllureReporter.prototype, "currentTest", { | ||
get: function () { | ||
if (this.runningTest === null) | ||
throw new Error("No active test"); | ||
return this.runningTest; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(JasmineAllureReporter.prototype, "currentExecutable", { | ||
get: function () { | ||
return this.runningExecutable; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
JasmineAllureReporter.prototype.writeAttachment = function (content, type) { | ||
} | ||
get currentTest() { | ||
if (this.runningTest === null) | ||
throw new Error("No active test"); | ||
return this.runningTest; | ||
} | ||
get currentExecutable() { | ||
return this.runningExecutable; | ||
} | ||
writeAttachment(content, type) { | ||
return this.runtime.writeAttachment(content, type); | ||
}; | ||
JasmineAllureReporter.prototype.jasmineStarted = function (suiteInfo) { | ||
}; | ||
JasmineAllureReporter.prototype.suiteStarted = function (suite) { | ||
var name = suite.description; | ||
var group = (this.getCurrentGroup() || this.runtime).startGroup(name); | ||
} | ||
jasmineStarted(suiteInfo) { | ||
} | ||
suiteStarted(suite) { | ||
const name = suite.description; | ||
const group = (this.getCurrentGroup() || this.runtime).startGroup(name); | ||
this.groupStack.push(group); | ||
}; | ||
JasmineAllureReporter.prototype.specStarted = function (spec) { | ||
var currentGroup = this.getCurrentGroup(); | ||
} | ||
specStarted(spec) { | ||
let currentGroup = this.getCurrentGroup(); | ||
if (currentGroup === null) | ||
@@ -90,4 +65,4 @@ throw new Error("No active suite"); | ||
this.groupStack.push(currentGroup); | ||
var name = spec.description; | ||
var allureTest = currentGroup.startTest(name); | ||
const name = spec.description; | ||
const allureTest = currentGroup.startTest(name); | ||
if (this.runningTest != null) | ||
@@ -108,5 +83,5 @@ throw new Error("Test is starting before other ended!"); | ||
} | ||
}; | ||
JasmineAllureReporter.prototype.specDone = function (spec) { | ||
var currentTest = this.runningTest; | ||
} | ||
specDone(spec) { | ||
const currentTest = this.runningTest; | ||
if (currentTest === null) | ||
@@ -116,4 +91,3 @@ throw new Error("specDone while no test is running"); | ||
console.error("Allure reporter issue: step stack is not empty on specDone"); | ||
for (var _i = 0, _a = this.stepStack.reverse(); _i < _a.length; _i++) { | ||
var step = _a[_i]; | ||
for (const step of this.stepStack.reverse()) { | ||
step.status = allure_js_commons_1.Status.BROKEN; | ||
@@ -142,3 +116,3 @@ step.stage = allure_js_commons_1.Stage.INTERRUPTED; | ||
} | ||
var exceptionInfo = this.findMessageAboutThrow(spec.failedExpectations) | ||
const exceptionInfo = this.findMessageAboutThrow(spec.failedExpectations) | ||
|| this.findAnyError(spec.failedExpectations); | ||
@@ -153,8 +127,8 @@ if (exceptionInfo !== null) { | ||
this.groupStack.pop(); | ||
}; | ||
JasmineAllureReporter.prototype.suiteDone = function (suite) { | ||
} | ||
suiteDone(suite) { | ||
if (this.runningTest !== null) { | ||
console.error("Allure reporter issue: running test on suiteDone"); | ||
} | ||
var currentGroup = this.getCurrentGroup(); | ||
const currentGroup = this.getCurrentGroup(); | ||
if (currentGroup === null) | ||
@@ -164,8 +138,7 @@ throw new Error("No active suite"); | ||
this.groupStack.pop(); | ||
}; | ||
JasmineAllureReporter.prototype.jasmineDone = function (runDetails) { | ||
}; | ||
JasmineAllureReporter.prototype.findMessageAboutThrow = function (expectations) { | ||
for (var _i = 0, _a = expectations || []; _i < _a.length; _i++) { | ||
var e = _a[_i]; | ||
} | ||
jasmineDone(runDetails) { | ||
} | ||
findMessageAboutThrow(expectations) { | ||
for (const e of expectations || []) { | ||
if (e.matcherName === "") | ||
@@ -175,4 +148,4 @@ return e; | ||
return null; | ||
}; | ||
JasmineAllureReporter.prototype.findAnyError = function (expectations) { | ||
} | ||
findAnyError(expectations) { | ||
expectations = expectations || []; | ||
@@ -182,24 +155,20 @@ if (expectations.length > 0) | ||
return null; | ||
}; | ||
JasmineAllureReporter.prototype.pushStep = function (step) { | ||
} | ||
pushStep(step) { | ||
this.stepStack.push(step); | ||
}; | ||
JasmineAllureReporter.prototype.popStep = function () { | ||
} | ||
popStep() { | ||
this.stepStack.pop(); | ||
}; | ||
Object.defineProperty(JasmineAllureReporter.prototype, "currentStep", { | ||
get: function () { | ||
if (this.stepStack.length > 0) | ||
return this.stepStack[this.stepStack.length - 1]; | ||
return null; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
JasmineAllureReporter.prototype.installHooks = function () { | ||
var reporter = this; | ||
var jasmineBeforeAll = eval("global.beforeAll"); | ||
var jasmineAfterAll = eval("global.afterAll"); | ||
var jasmineBeforeEach = eval("global.beforeEach"); | ||
var jasmineAfterEach = eval("global.afterEach"); | ||
} | ||
get currentStep() { | ||
if (this.stepStack.length > 0) | ||
return this.stepStack[this.stepStack.length - 1]; | ||
return null; | ||
} | ||
installHooks() { | ||
const reporter = this; | ||
const jasmineBeforeAll = eval("global.beforeAll"); | ||
const jasmineAfterAll = eval("global.afterAll"); | ||
const jasmineBeforeEach = eval("global.beforeEach"); | ||
const jasmineAfterEach = eval("global.afterEach"); | ||
function makeWrapperAll(wrapped, fun) { | ||
@@ -209,9 +178,9 @@ return function (action, timeout) { | ||
reporter.runningExecutable = fun(); | ||
var ret; | ||
let ret; | ||
if (action.length > 0) { | ||
ret = reporter.runningExecutable.wrap(function () { return new Promise(function (resolve, reject) { | ||
var t = resolve; | ||
ret = reporter.runningExecutable.wrap(() => new Promise((resolve, reject) => { | ||
const t = resolve; | ||
t.fail = reject; | ||
action(t); | ||
}); })(); | ||
}))(); | ||
} | ||
@@ -222,6 +191,6 @@ else { | ||
if (allure_js_commons_1.isPromise(ret)) { | ||
ret.then(function () { | ||
ret.then(() => { | ||
reporter.runningExecutable = null; | ||
done(); | ||
}).catch(function (e) { | ||
}).catch(e => { | ||
reporter.runningExecutable = null; | ||
@@ -238,6 +207,6 @@ done.fail(e); | ||
} | ||
var wrapperBeforeAll = makeWrapperAll(jasmineBeforeAll, function () { return reporter.currentGroup.addBefore(); }); | ||
var wrapperAfterAll = makeWrapperAll(jasmineAfterAll, function () { return reporter.currentGroup.addAfter(); }); | ||
var wrapperBeforeEach = makeWrapperAll(jasmineBeforeEach, function () { return reporter.currentGroup.addBefore(); }); | ||
var wrapperAfterEach = makeWrapperAll(jasmineAfterEach, function () { return reporter.currentGroup.addAfter(); }); | ||
const wrapperBeforeAll = makeWrapperAll(jasmineBeforeAll, () => reporter.currentGroup.addBefore()); | ||
const wrapperAfterAll = makeWrapperAll(jasmineAfterAll, () => reporter.currentGroup.addAfter()); | ||
const wrapperBeforeEach = makeWrapperAll(jasmineBeforeEach, () => reporter.currentGroup.addBefore()); | ||
const wrapperAfterEach = makeWrapperAll(jasmineAfterEach, () => reporter.currentGroup.addAfter()); | ||
eval("global.beforeAll = wrapperBeforeAll;"); | ||
@@ -247,73 +216,66 @@ eval("global.afterAll = wrapperAfterAll;"); | ||
eval("global.afterEach = wrapperAfterEach;"); | ||
}; | ||
return JasmineAllureReporter; | ||
}()); | ||
} | ||
} | ||
exports.JasmineAllureReporter = JasmineAllureReporter; | ||
var JasmineAllureInterface = (function (_super) { | ||
__extends(JasmineAllureInterface, _super); | ||
function JasmineAllureInterface(reporter) { | ||
var _this = _super.call(this) || this; | ||
_this.reporter = reporter; | ||
return _this; | ||
class JasmineAllureInterface extends allure_js_commons_1.AllureInterface { | ||
constructor(reporter) { | ||
super(); | ||
this.reporter = reporter; | ||
} | ||
Object.defineProperty(JasmineAllureInterface.prototype, "currentExecutable", { | ||
get: function () { | ||
return this.reporter.currentStep | ||
|| this.reporter.currentExecutable | ||
|| this.reporter.currentTest; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
JasmineAllureInterface.prototype.setDescription = function (text) { | ||
get currentExecutable() { | ||
return this.reporter.currentStep | ||
|| this.reporter.currentExecutable | ||
|| this.reporter.currentTest; | ||
} | ||
setDescription(text) { | ||
this.currentExecutable.description = text; | ||
this.currentExecutable.descriptionHtml = text; | ||
}; | ||
JasmineAllureInterface.prototype.setFlaky = function () { | ||
} | ||
setFlaky() { | ||
this.currentExecutable.detailsFlaky = true; | ||
}; | ||
JasmineAllureInterface.prototype.setKnown = function () { | ||
} | ||
setKnown() { | ||
this.currentExecutable.detailsKnown = true; | ||
}; | ||
JasmineAllureInterface.prototype.setMuted = function () { | ||
} | ||
setMuted() { | ||
this.currentExecutable.detailsMuted = true; | ||
}; | ||
JasmineAllureInterface.prototype.addOwner = function (owner) { | ||
} | ||
addOwner(owner) { | ||
if (this.reporter.currentTest === null) | ||
throw new Error("No test running!"); | ||
this.reporter.currentTest.addLabel(allure_js_commons_1.LabelName.OWNER, owner); | ||
}; | ||
JasmineAllureInterface.prototype.setSeverity = function (severity) { | ||
} | ||
setSeverity(severity) { | ||
if (this.reporter.currentTest === null) | ||
throw new Error("No test running!"); | ||
this.reporter.currentTest.addLabel(allure_js_commons_1.LabelName.SEVERITY, severity); | ||
}; | ||
JasmineAllureInterface.prototype.addIssue = function (issue) { | ||
} | ||
addIssue(issue) { | ||
if (this.reporter.currentTest === null) | ||
throw new Error("No test running!"); | ||
this.reporter.currentTest.addLabel(allure_js_commons_1.LabelName.ISSUE, issue); | ||
}; | ||
JasmineAllureInterface.prototype.addTag = function (tag) { | ||
} | ||
addTag(tag) { | ||
if (this.reporter.currentTest === null) | ||
throw new Error("No test running!"); | ||
this.reporter.currentTest.addLabel(allure_js_commons_1.LabelName.TAG, tag); | ||
}; | ||
JasmineAllureInterface.prototype.addTestType = function (type) { | ||
} | ||
addTestType(type) { | ||
if (this.reporter.currentTest === null) | ||
throw new Error("No test running!"); | ||
this.reporter.currentTest.addLabel(allure_js_commons_1.LabelName.TEST_TYPE, type); | ||
}; | ||
JasmineAllureInterface.prototype.addLink = function (name, url, type) { | ||
} | ||
addLink(name, url, type) { | ||
if (this.reporter.currentTest === null) | ||
throw new Error("No test running!"); | ||
this.reporter.currentTest.addLink(name, url, type); | ||
}; | ||
JasmineAllureInterface.prototype.startStep = function (name) { | ||
var allureStep = this.currentExecutable.startStep(name); | ||
} | ||
startStep(name) { | ||
const allureStep = this.currentExecutable.startStep(name); | ||
this.reporter.pushStep(allureStep); | ||
return new WrappedStep(this.reporter, allureStep); | ||
}; | ||
JasmineAllureInterface.prototype.step = function (name, body) { | ||
var wrappedStep = this.startStep(name); | ||
var result; | ||
} | ||
step(name, body) { | ||
const wrappedStep = this.startStep(name); | ||
let result; | ||
try { | ||
@@ -327,7 +289,7 @@ result = wrappedStep.run(body); | ||
if (allure_js_commons_1.isPromise(result)) { | ||
var promise = result; | ||
return promise.then(function (a) { | ||
const promise = result; | ||
return promise.then(a => { | ||
wrappedStep.endStep(); | ||
return a; | ||
}).catch(function (e) { | ||
}).catch(e => { | ||
wrappedStep.endStep(); | ||
@@ -341,42 +303,40 @@ throw e; | ||
} | ||
}; | ||
JasmineAllureInterface.prototype.attachment = function (name, content, type) { | ||
var file = this.reporter.writeAttachment(content, type); | ||
} | ||
attachment(name, content, type) { | ||
const file = this.reporter.writeAttachment(content, type); | ||
this.currentExecutable.addAttachment(name, type, file); | ||
}; | ||
JasmineAllureInterface.prototype.addParameter = function (name, value) { | ||
} | ||
addParameter(name, value) { | ||
if (this.reporter.currentTest === null) | ||
throw new Error("No test running!"); | ||
this.reporter.currentTest.addParameter(name, value); | ||
}; | ||
JasmineAllureInterface.prototype.addLabel = function (name, value) { | ||
} | ||
addLabel(name, value) { | ||
if (this.reporter.currentTest === null) | ||
throw new Error("No test running!"); | ||
this.reporter.currentTest.addLabel(name, value); | ||
}; | ||
JasmineAllureInterface.prototype.getGlobalInfoWriter = function () { | ||
} | ||
getGlobalInfoWriter() { | ||
return this.reporter.getGlobalInfoWriter(); | ||
}; | ||
return JasmineAllureInterface; | ||
}(allure_js_commons_1.AllureInterface)); | ||
} | ||
} | ||
exports.JasmineAllureInterface = JasmineAllureInterface; | ||
var WrappedStep = (function () { | ||
function WrappedStep(reporter, step) { | ||
class WrappedStep { | ||
constructor(reporter, step) { | ||
this.reporter = reporter; | ||
this.step = step; | ||
} | ||
WrappedStep.prototype.startStep = function (name) { | ||
var step = this.step.startStep(name); | ||
startStep(name) { | ||
const step = this.step.startStep(name); | ||
this.reporter.pushStep(step); | ||
return new WrappedStep(this.reporter, step); | ||
}; | ||
WrappedStep.prototype.endStep = function () { | ||
} | ||
endStep() { | ||
this.reporter.popStep(); | ||
this.step.endStep(); | ||
}; | ||
WrappedStep.prototype.run = function (body) { | ||
} | ||
run(body) { | ||
return this.step.wrap(body)(); | ||
}; | ||
return WrappedStep; | ||
}()); | ||
} | ||
} | ||
//# sourceMappingURL=JasmineAllureReporter.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var JasmineConsoleReporter = (function () { | ||
function JasmineConsoleReporter() { | ||
class JasmineConsoleReporter { | ||
log(message) { | ||
console.log(new Date().toISOString(), message); | ||
} | ||
JasmineConsoleReporter.prototype.log = function (message) { | ||
console.log(new Date().toISOString(), message); | ||
}; | ||
JasmineConsoleReporter.prototype.suiteStarted = function (suite) { | ||
this.log("Suite started: " + suite.fullName); | ||
}; | ||
JasmineConsoleReporter.prototype.suiteDone = function () { | ||
suiteStarted(suite) { | ||
this.log(`Suite started: ${suite.fullName}`); | ||
} | ||
suiteDone() { | ||
this.log("Suite ended\n\n"); | ||
}; | ||
JasmineConsoleReporter.prototype.specStarted = function (spec) { | ||
this.log("Case started: " + spec.description); | ||
}; | ||
JasmineConsoleReporter.prototype.specDone = function (spec) { | ||
this.log("Case ended: " + spec.status + "\n\n"); | ||
}; | ||
return JasmineConsoleReporter; | ||
}()); | ||
} | ||
specStarted(spec) { | ||
this.log(`Case started: ${spec.description}`); | ||
} | ||
specDone(spec) { | ||
this.log(`Case ended: ${spec.status}\n\n`); | ||
} | ||
} | ||
exports.JasmineConsoleReporter = JasmineConsoleReporter; | ||
//# sourceMappingURL=JasmineConsoleReporter.js.map |
@@ -189,3 +189,3 @@ Apache License | ||
Copyright 2018 Qameta Software | ||
Copyright 2019 Qameta Software | ||
@@ -192,0 +192,0 @@ Licensed under the Apache License, Version 2.0 (the "License"); |
{ | ||
"name": "allure-jasmine", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-beta.3", | ||
"description": "Allure Jasmine integration", | ||
@@ -27,5 +27,5 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"allure-js-commons": "^2.0.0-beta.2" | ||
"allure-js-commons": "^2.0.0-beta.3" | ||
}, | ||
"gitHead": "3fa87a0342b7920642642c6afb3091077e5296f4" | ||
"gitHead": "600e5dacbc6587d3d2994b26c44e5dbf2e6f2099" | ||
} |
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
40618
421