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

mocha-allure-reporter

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocha-allure-reporter - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

38

index.js

@@ -20,17 +20,27 @@ "use strict";

runner.on("suite", function (suite) {
function invokeHanlder(handler) {
return function() {
try {
return handler.apply(this, arguments);
} catch(error) {
console.error("Internal error in Allure:", error); // eslint-disable-line no-console
}
};
}
runner.on("suite", invokeHanlder(function (suite) {
allureReporter.startSuite(suite.fullTitle());
});
}));
runner.on("suite end", function () {
runner.on("suite end", invokeHanlder(function () {
allureReporter.endSuite();
});
}));
runner.on("test", function(test) {
runner.on("test", invokeHanlder(function(test) {
if (typeof test.currentRetry !== "function" || !test.currentRetry()) {
allureReporter.startCase(test.title);
}
});
}));
runner.on("pending", function(test) {
runner.on("pending", invokeHanlder(function(test) {
var currentTest = allureReporter.getCurrentTest();

@@ -42,9 +52,9 @@ if(currentTest && currentTest.name === test.title) {

}
});
}));
runner.on("pass", function() {
runner.on("pass", invokeHanlder(function() {
allureReporter.endCase("passed");
});
}));
runner.on("fail", function(test, err) {
runner.on("fail", invokeHanlder(function(test, err) {
if(!allureReporter.getCurrentTest()) {

@@ -58,11 +68,11 @@ allureReporter.startCase(test.title);

allureReporter.endCase(status, err);
});
}));
runner.on("hook end", function(hook) {
runner.on("hook end", invokeHanlder(function(hook) {
if(hook.title.indexOf('"after each" hook') === 0) {
allureReporter.endCase("passed");
}
});
}));
}
module.exports = AllureReporter;
{
"name": "mocha-allure-reporter",
"version": "1.3.1",
"version": "1.3.2",
"description": "Mocha reporter for Allure framework",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -133,2 +133,17 @@ var path = require("path");

});
it("should report internal errors", function(done) {
sinon.stub(console, "error");
var mocha = new Mocha({
reporter: reporter
});
allureMock.endSuite.onCall(1).throws();
mocha.addFile(path.join(__dirname, "../fixtures/retries.spec.js"));
mocha.run(function() {
expect(console.error).callCount(1);
expect(console.error).calledWith("Internal error in Allure:", sinon.match.instanceOf(Error));
console.error.restore();
done();
});
});
});

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