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.18 to 2.0.0-beta.19

2

dist/AllureReporter.d.ts

@@ -7,2 +7,3 @@ /// <reference types="node" />

currentExecutable: ExecutableItemWrapper | null;
private cwd;
private suites;

@@ -30,3 +31,4 @@ private steps;

popSuite(): void;
private getSuitePath;
private endTest;
}

@@ -5,2 +5,3 @@ "use strict";

const crypto_1 = require("crypto");
const path_1 = require("path");
const allure_js_commons_1 = require("allure-js-commons");

@@ -12,2 +13,3 @@ const MochaAllure_1 = require("./MochaAllure");

this.currentExecutable = null;
this.cwd = process.cwd();
this.suites = [];

@@ -72,5 +74,7 @@ this.steps = [];

startCase(test) {
var _a;
if (this.currentSuite === null) {
throw new Error("No active suite");
}
const testPath = (_a = test.file) === null || _a === void 0 ? void 0 : _a.replace(this.cwd, "");
this.currentTest = this.currentSuite.startTest(test.title);

@@ -80,4 +84,11 @@ this.currentTest.fullName = test.title;

this.currentTest.stage = allure_js_commons_1.Stage.RUNNING;
if (testPath) {
const normalizedTestPath = (0, path_1.normalize)(testPath || "")
.replace(/^\//, "")
.split("/")
.filter((item) => item !== (0, path_1.basename)(testPath));
this.currentTest.addLabel(allure_js_commons_1.LabelName.PACKAGE, normalizedTestPath.join("."));
}
if (test.parent) {
const [parentSuite, suite, ...subSuites] = test.parent.titlePath();
const [parentSuite, suite, ...subSuites] = this.getSuitePath(test);
if (parentSuite) {

@@ -132,2 +143,13 @@ this.currentTest.addLabel(allure_js_commons_1.LabelName.PARENT_SUITE, parentSuite);

}
getSuitePath(test) {
const path = [];
let currentSuite = test.parent;
while (currentSuite) {
if (currentSuite.title) {
path.unshift(currentSuite.title);
}
currentSuite = currentSuite.parent;
}
return path;
}
endTest(status, details) {

@@ -134,0 +156,0 @@ if (this.currentTest === null) {

8

dist/MochaAllureReporter.d.ts
import * as Mocha from "mocha";
import { MochaAllure } from "./MochaAllure";
export declare let allure: MochaAllure;
declare type ParallelRunner = Mocha.Runner & {
linkPartialObjects?: (val: boolean) => ParallelRunner;
};
export declare class MochaAllureReporter extends Mocha.reporters.Base {
readonly runner: Mocha.Runner;
readonly runner: ParallelRunner;
readonly opts: Mocha.MochaOptions;
private coreReporter;
constructor(runner: Mocha.Runner, opts: Mocha.MochaOptions);
constructor(runner: ParallelRunner, opts: Mocha.MochaOptions);
private onSuite;

@@ -18,1 +21,2 @@ private onSuiteEnd;

}
export {};

@@ -26,2 +26,3 @@ "use strict";

const AllureReporter_1 = require("./AllureReporter");
const { EVENT_SUITE_BEGIN, EVENT_SUITE_END, EVENT_TEST_BEGIN, EVENT_TEST_END, EVENT_TEST_PASS, EVENT_TEST_FAIL, EVENT_TEST_PENDING, EVENT_HOOK_BEGIN, EVENT_HOOK_END, } = Mocha.Runner.constants;
class MochaAllureReporter extends Mocha.reporters.Base {

@@ -36,11 +37,14 @@ constructor(runner, opts) {

exports.allure = this.coreReporter.getImplementation();
this.runner
.on("suite", this.onSuite.bind(this))
.on("suite end", this.onSuiteEnd.bind(this))
.on("test", this.onTest.bind(this))
.on("pass", this.onPassed.bind(this))
.on("fail", this.onFailed.bind(this))
.on("pending", this.onPending.bind(this))
.on("hook", this.onHookStart.bind(this))
.on("hook end", this.onHookEnd.bind(this));
if (runner.linkPartialObjects) {
runner.linkPartialObjects(true);
}
runner
.on(EVENT_SUITE_BEGIN, this.onSuite.bind(this))
.on(EVENT_SUITE_END, this.onSuiteEnd.bind(this))
.on(EVENT_TEST_BEGIN, this.onTest.bind(this))
.on(EVENT_TEST_PASS, this.onPassed.bind(this))
.on(EVENT_TEST_FAIL, this.onFailed.bind(this))
.on(EVENT_TEST_PENDING, this.onPending.bind(this))
.on(EVENT_HOOK_BEGIN, this.onHookStart.bind(this))
.on(EVENT_HOOK_END, this.onHookEnd.bind(this));
}

@@ -47,0 +51,0 @@ onSuite(suite) {

{
"name": "allure-mocha",
"version": "2.0.0-beta.18",
"version": "2.0.0-beta.19",
"description": "Allure Mocha integration",

@@ -48,3 +48,3 @@ "license": "Apache-2.0",

"dependencies": {
"allure-js-commons": "2.0.0-beta.18"
"allure-js-commons": "2.0.0-beta.19"
},

@@ -51,0 +51,0 @@ "peerDependencies": {

@@ -10,3 +10,5 @@ # allure-mocha

```
or via yarn:
```bash

@@ -18,5 +20,5 @@ yarn add allure-mocha mocha --dev

- typescript
- mocha-typescript
- source-map-support
- typescript
- mocha-typescript
- source-map-support

@@ -37,3 +39,3 @@ ## Usage

If you want to provide extra information, such as steps and attachments, import the `allure` object
If you want to provide extra information, such as steps and attachments, import the `allure` object
into your code:

@@ -43,10 +45,10 @@

// es-modules
import { allure } from 'allure-mocha/runtime';
import { allure } from "allure-mocha/runtime";
// or commonjs
const { allure } = require('allure-mocha/runtime');
const { allure } = require("allure-mocha/runtime");
it('is a test', () => {
allure.epic('Some info');
it("is a test", () => {
allure.epic("Some info");
});
```
```

@@ -53,0 +55,0 @@ ## Decorators Support

export { MochaAllure } from "./dist/MochaAllure";
export { MochaAllureReporter } from "./dist/MochaAllureReporter";
export { allure } from './dist/MochaAllureReporter';
export { allure } from "./dist/MochaAllureReporter";

@@ -12,3 +12,3 @@ // Typescript does not handle re-exported values correctly

Object.defineProperty(exports, "__esModule", {
value: true
value: true,
});

@@ -19,3 +19,3 @@ Object.defineProperty(module.exports, "MochaAllure", {

return _MochaAllure.MochaAllure;
}
},
});

@@ -26,3 +26,3 @@ Object.defineProperty(module.exports, "allure", {

return _MochaAllureReporter.allure;
}
},
});

@@ -33,3 +33,3 @@ Object.defineProperty(module.exports, "MochaAllureReporter", {

return _MochaAllureReporter.MochaAllureReporter;
}
},
});

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