Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

allure-mocha

Package Overview
Dependencies
Maintainers
3
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

allure-mocha - npm Package Compare versions

Comparing version 2.0.0-beta.6 to 2.0.0-beta.7

dist/MochaAllure.d.ts

20

dist/AllureReporter.d.ts
/// <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;

48

dist/AllureReporter.js
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc