allure-mocha
Advanced tools
Comparing version 2.0.0-beta.6 to 2.0.0-beta.7
/// <reference types="node" /> | ||
import { AllureGroup, AllureRuntime, AllureStep, AllureTest, ContentType } from "allure-js-commons"; | ||
import { MochaAllureInterface } from "./MochaAllureInterface"; | ||
import { AllureGroup, AllureRuntime, AllureStep, AllureTest, ContentType, ExecutableItemWrapper } from "allure-js-commons"; | ||
import { MochaAllure } from "./MochaAllure"; | ||
export declare class AllureReporter { | ||
private runtime; | ||
private readonly allureRuntime; | ||
private suites; | ||
private steps; | ||
private runningTest; | ||
constructor(runtime: AllureRuntime); | ||
getInterface(): MochaAllureInterface; | ||
readonly currentSuite: AllureGroup | null; | ||
readonly currentStep: AllureStep | null; | ||
currentTest: AllureTest | null; | ||
currentExecutable: ExecutableItemWrapper | null; | ||
constructor(allureRuntime: AllureRuntime); | ||
getImplementation(): MochaAllure; | ||
get currentSuite(): AllureGroup | null; | ||
get currentStep(): AllureStep | null; | ||
get currentTest(): AllureTest | null; | ||
set currentTest(test: AllureTest | null); | ||
startSuite(suiteName: string): void; | ||
endSuite(): void; | ||
startHook(title: string): void; | ||
endHook(error?: Error): void; | ||
startCase(test: Mocha.Test): void; | ||
@@ -17,0 +21,0 @@ passTestCase(test: Mocha.Test): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AllureReporter = void 0; | ||
const allure_js_commons_1 = require("allure-js-commons"); | ||
const crypto_1 = require("crypto"); | ||
const MochaAllureInterface_1 = require("./MochaAllureInterface"); | ||
const MochaAllure_1 = require("./MochaAllure"); | ||
class AllureReporter { | ||
constructor(runtime) { | ||
this.runtime = runtime; | ||
constructor(allureRuntime) { | ||
this.allureRuntime = allureRuntime; | ||
this.suites = []; | ||
this.steps = []; | ||
this.runningTest = null; | ||
this.currentExecutable = null; | ||
} | ||
getInterface() { | ||
return new MochaAllureInterface_1.MochaAllureInterface(this, this.runtime); | ||
getImplementation() { | ||
return new MochaAllure_1.MochaAllure(this, this.allureRuntime); | ||
} | ||
get currentSuite() { | ||
if (this.suites.length === 0) { | ||
return null; | ||
} | ||
return this.suites[this.suites.length - 1]; | ||
return this.suites.length > 0 ? this.suites[this.suites.length - 1] : null; | ||
} | ||
get currentStep() { | ||
if (this.steps.length > 0) { | ||
return this.steps[this.steps.length - 1]; | ||
} | ||
return null; | ||
return this.steps.length > 0 ? this.steps[this.steps.length - 1] : null; | ||
} | ||
@@ -35,3 +31,3 @@ get currentTest() { | ||
startSuite(suiteName) { | ||
const scope = this.currentSuite || this.runtime; | ||
const scope = this.currentSuite || this.allureRuntime; | ||
const suite = scope.startGroup(suiteName || "Global"); | ||
@@ -49,2 +45,23 @@ this.pushSuite(suite); | ||
} | ||
startHook(title) { | ||
const suite = this.currentSuite; | ||
if (suite && title && title.indexOf("before") !== -1) { | ||
this.currentExecutable = suite.addBefore(); | ||
} | ||
else if (suite && title && title.indexOf("after") !== -1) { | ||
this.currentExecutable = suite.addAfter(); | ||
} | ||
} | ||
endHook(error) { | ||
if (this.currentExecutable) { | ||
this.currentExecutable.stage = allure_js_commons_1.Stage.FINISHED; | ||
if (error) { | ||
this.currentExecutable.status = allure_js_commons_1.Status.FAILED; | ||
this.currentExecutable.statusDetails = { message: error.message, trace: error.stack }; | ||
} | ||
else { | ||
this.currentExecutable.status = allure_js_commons_1.Status.PASSED; | ||
} | ||
} | ||
} | ||
startCase(test) { | ||
@@ -97,3 +114,3 @@ if (this.currentSuite === null) { | ||
writeAttachment(content, type) { | ||
return this.runtime.writeAttachment(content, type); | ||
return this.allureRuntime.writeAttachment(content, type); | ||
} | ||
@@ -122,2 +139,3 @@ pushStep(step) { | ||
this.currentTest.endTest(); | ||
this.currentTest = null; | ||
} | ||
@@ -124,0 +142,0 @@ } |
import * as Mocha from "mocha"; | ||
import { MochaAllureInterface } from "./MochaAllureInterface"; | ||
export declare let allure: MochaAllureInterface; | ||
import { MochaAllure } from "./MochaAllure"; | ||
export declare let allure: MochaAllure; | ||
export declare class MochaAllureReporter extends Mocha.reporters.Base { | ||
@@ -15,2 +15,4 @@ readonly runner: Mocha.Runner; | ||
private onPending; | ||
private onHookStart; | ||
private onHookEnd; | ||
} |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MochaAllureReporter = exports.allure = void 0; | ||
const Mocha = __importStar(require("mocha")); | ||
@@ -20,3 +33,3 @@ const allure_js_commons_1 = require("allure-js-commons"); | ||
this.coreReporter = new AllureReporter_1.AllureReporter(new allure_js_commons_1.AllureRuntime(allureConfig)); | ||
exports.allure = this.coreReporter.getInterface(); | ||
exports.allure = this.coreReporter.getImplementation(); | ||
this.runner | ||
@@ -28,3 +41,5 @@ .on("suite", this.onSuite.bind(this)) | ||
.on("fail", this.onFailed.bind(this)) | ||
.on("pending", this.onPending.bind(this)); | ||
.on("pending", this.onPending.bind(this)) | ||
.on("hook", this.onHookStart.bind(this)) | ||
.on("hook end", this.onHookEnd.bind(this)); | ||
} | ||
@@ -49,4 +64,10 @@ onSuite(suite) { | ||
} | ||
onHookStart(hook) { | ||
this.coreReporter.startHook(hook.title); | ||
} | ||
onHookEnd(hook) { | ||
this.coreReporter.endHook(hook.error()); | ||
} | ||
} | ||
exports.MochaAllureReporter = MochaAllureReporter; | ||
//# sourceMappingURL=MochaAllureReporter.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.StepWrapper = void 0; | ||
class StepWrapper { | ||
@@ -4,0 +5,0 @@ constructor(reporter, step) { |
{ | ||
"name": "allure-mocha", | ||
"version": "2.0.0-beta.6", | ||
"version": "2.0.0-beta.7", | ||
"description": "Allure Mocha integration", | ||
@@ -14,2 +14,3 @@ "license": "Apache-2.0", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
@@ -28,20 +29,20 @@ "clean": "rimraf ./dist ./out", | ||
"devDependencies": { | ||
"@types/chai": "^4.1.7", | ||
"@types/mocha": "^5.2.6", | ||
"@testdeck/mocha": "0.0.10", | ||
"@types/chai": "^4.2.11", | ||
"@types/mocha": "^7.0.2", | ||
"chai": "^4.2.0", | ||
"codecov": "^3.3.0", | ||
"dotenv": "^8.0.0", | ||
"fs-jetpack": "^2.2.2", | ||
"mocha": "^6.2.0", | ||
"mocha-multi": "^1.1.1", | ||
"mocha-typescript": "^1.1.17", | ||
"nyc": "^14.0.0", | ||
"prettier": "^1.17.0", | ||
"source-map-support": "^0.5.12" | ||
"codecov": "^3.6.5", | ||
"dotenv": "^8.2.0", | ||
"fs-jetpack": "^2.2.3", | ||
"mocha": "^7.1.2", | ||
"mocha-multi": "^1.1.3", | ||
"nyc": "^15.0.1", | ||
"prettier": "^2.0.5", | ||
"source-map-support": "^0.5.19" | ||
}, | ||
"dependencies": { | ||
"allure-js-commons": "^2.0.0-beta.6" | ||
"allure-js-commons": "^2.0.0-beta.7" | ||
}, | ||
"peerDependencies": { | ||
"mocha": "^6.2.0" | ||
"mocha": ">=6.2.x" | ||
}, | ||
@@ -57,4 +58,6 @@ "nyc": { | ||
], | ||
"include": [ | ||
"dist/src/**/*.js" | ||
"exclude": [ | ||
"test/**/*.*", | ||
"**/*.d.ts", | ||
"runtime.js" | ||
], | ||
@@ -69,3 +72,3 @@ "reporter": [ | ||
}, | ||
"gitHead": "fdcb2b0cccae08b1b3ae5838a11891150b256f8c" | ||
"gitHead": "79d3a6088a035d4310c1997aa897839ed5d9be4e" | ||
} |
@@ -1,1 +0,3 @@ | ||
export { allure } from "./dist/MochaAllureReporter"; | ||
export { MochaAllure } from "./dist/MochaAllure"; | ||
export { MochaAllureReporter } from "./dist/MochaAllureReporter"; | ||
export { allure } from './dist/MochaAllureReporter'; |
@@ -8,9 +8,25 @@ // Typescript does not handle re-exported values correctly | ||
const reporter = require("./dist/MochaAllureReporter"); | ||
const _MochaAllure = require("./dist/MochaAllure"); | ||
const _MochaAllureReporter = require("./dist/MochaAllureReporter"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(module.exports, "MochaAllure", { | ||
enumerable: true, | ||
get: function () { | ||
return _MochaAllure.MochaAllure; | ||
} | ||
}); | ||
Object.defineProperty(module.exports, "allure", { | ||
get() { | ||
return reporter.allure; | ||
enumerable: true, | ||
get: function () { | ||
return _MochaAllureReporter.allure; | ||
} | ||
}); | ||
Object.defineProperty(module.exports, "MochaAllureReporter", { | ||
enumerable: true, | ||
get: function () { | ||
return _MochaAllureReporter.MochaAllureReporter; | ||
} | ||
}); |
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
38773
409
+ Addedansi-colors@4.1.3(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedanymatch@3.1.3(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedbinary-extensions@2.3.0(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedcamelcase@6.3.0(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedchokidar@3.6.0(transitive)
+ Addedcliui@7.0.4(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddecamelize@4.0.0(transitive)
+ Addeddiff@5.2.0(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedescape-string-regexp@4.0.0(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedfind-up@5.0.0(transitive)
+ Addedflat@5.0.2(transitive)
+ Addedfsevents@2.3.3(transitive)
+ Addedglob@8.1.0(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedis-binary-path@2.1.0(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedis-plain-obj@2.1.0(transitive)
+ Addedis-unicode-supported@0.1.0(transitive)
+ Addedjs-yaml@4.1.0(transitive)
+ Addedlocate-path@6.0.0(transitive)
+ Addedlog-symbols@4.1.0(transitive)
+ Addedminimatch@5.1.6(transitive)
+ Addedmocha@11.0.0(transitive)
+ Addedms@2.1.3(transitive)
+ Addednormalize-path@3.0.0(transitive)
+ Addedp-limit@3.1.0(transitive)
+ Addedp-locate@5.0.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedrandombytes@2.1.0(transitive)
+ Addedreaddirp@3.6.0(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedserialize-javascript@6.0.2(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedstrip-json-comments@3.1.1(transitive)
+ Addedsupports-color@7.2.08.1.1(transitive)
+ Addedto-regex-range@5.0.1(transitive)
+ Addedworkerpool@6.5.1(transitive)
+ Addedwrap-ansi@7.0.0(transitive)
+ Addedy18n@5.0.8(transitive)
+ Addedyargs@16.2.0(transitive)
+ Addedyargs-parser@20.2.9(transitive)
+ Addedyargs-unparser@2.0.0(transitive)
+ Addedyocto-queue@0.1.0(transitive)
- Removedansi-colors@3.2.3(transitive)
- Removedansi-regex@3.0.1(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedargparse@1.0.10(transitive)
- Removedarray-buffer-byte-length@1.0.1(transitive)
- Removedarray.prototype.reduce@1.0.7(transitive)
- Removedarraybuffer.prototype.slice@1.0.3(transitive)
- Removedavailable-typed-arrays@1.0.7(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcall-bind@1.0.7(transitive)
- Removedcamelcase@5.3.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcliui@5.0.0(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddata-view-buffer@1.0.1(transitive)
- Removeddata-view-byte-length@1.0.1(transitive)
- Removeddata-view-byte-offset@1.0.0(transitive)
- Removeddebug@3.2.6(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddefine-properties@1.2.1(transitive)
- Removeddiff@3.5.0(transitive)
- Removedemoji-regex@7.0.3(transitive)
- Removedes-abstract@1.23.5(transitive)
- Removedes-array-method-boxes-properly@1.0.0(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-object-atoms@1.0.0(transitive)
- Removedes-set-tostringtag@2.0.3(transitive)
- Removedes-to-primitive@1.2.1(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedesprima@4.0.1(transitive)
- Removedfind-up@3.0.0(transitive)
- Removedflat@4.1.1(transitive)
- Removedfor-each@0.3.3(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedfunction.prototype.name@1.1.6(transitive)
- Removedfunctions-have-names@1.2.3(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedget-symbol-description@1.0.2(transitive)
- Removedglob@7.1.3(transitive)
- Removedglobalthis@1.0.4(transitive)
- Removedgopd@1.0.1(transitive)
- Removedgrowl@1.10.5(transitive)
- Removedhas-bigints@1.0.2(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedinternal-slot@1.0.7(transitive)
- Removedis-array-buffer@3.0.4(transitive)
- Removedis-bigint@1.0.4(transitive)
- Removedis-boolean-object@1.1.2(transitive)
- Removedis-buffer@2.0.5(transitive)
- Removedis-callable@1.2.7(transitive)
- Removedis-data-view@1.0.1(transitive)
- Removedis-date-object@1.0.5(transitive)
- Removedis-fullwidth-code-point@2.0.0(transitive)
- Removedis-negative-zero@2.0.3(transitive)
- Removedis-number-object@1.0.7(transitive)
- Removedis-regex@1.1.4(transitive)
- Removedis-shared-array-buffer@1.0.3(transitive)
- Removedis-string@1.0.7(transitive)
- Removedis-symbol@1.0.4(transitive)
- Removedis-typed-array@1.1.13(transitive)
- Removedis-weakref@1.0.2(transitive)
- Removedisarray@2.0.5(transitive)
- Removedisexe@2.0.0(transitive)
- Removedjs-yaml@3.13.1(transitive)
- Removedlocate-path@3.0.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlog-symbols@2.2.0(transitive)
- Removedminimatch@3.0.4(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.4(transitive)
- Removedmocha@6.2.3(transitive)
- Removedms@2.1.1(transitive)
- Removednode-environment-flags@1.0.5(transitive)
- Removedobject-inspect@1.13.3(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedobject.assign@4.1.04.1.5(transitive)
- Removedobject.getownpropertydescriptors@2.1.8(transitive)
- Removedp-limit@2.3.0(transitive)
- Removedp-locate@3.0.0(transitive)
- Removedp-try@2.2.0(transitive)
- Removedpath-exists@3.0.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpossible-typed-array-names@1.0.0(transitive)
- Removedregexp.prototype.flags@1.5.3(transitive)
- Removedrequire-main-filename@2.0.0(transitive)
- Removedsafe-array-concat@1.1.2(transitive)
- Removedsafe-regex-test@1.0.3(transitive)
- Removedsemver@5.7.2(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedset-function-name@2.0.2(transitive)
- Removedside-channel@1.0.6(transitive)
- Removedsprintf-js@1.0.3(transitive)
- Removedstring-width@2.1.13.1.0(transitive)
- Removedstring.prototype.trim@1.2.9(transitive)
- Removedstring.prototype.trimend@1.0.8(transitive)
- Removedstring.prototype.trimstart@1.0.8(transitive)
- Removedstrip-ansi@4.0.0(transitive)
- Removedstrip-json-comments@2.0.1(transitive)
- Removedsupports-color@5.5.06.0.0(transitive)
- Removedtyped-array-buffer@1.0.2(transitive)
- Removedtyped-array-byte-length@1.0.1(transitive)
- Removedtyped-array-byte-offset@1.0.2(transitive)
- Removedtyped-array-length@1.0.6(transitive)
- Removedunbox-primitive@1.0.2(transitive)
- Removedwhich@1.3.1(transitive)
- Removedwhich-boxed-primitive@1.0.2(transitive)
- Removedwhich-module@2.0.1(transitive)
- Removedwhich-typed-array@1.1.15(transitive)
- Removedwide-align@1.1.3(transitive)
- Removedwrap-ansi@5.1.0(transitive)
- Removedy18n@4.0.3(transitive)
- Removedyargs@13.3.2(transitive)
- Removedyargs-parser@13.1.2(transitive)
- Removedyargs-unparser@1.6.0(transitive)