Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Commit

Permalink
include after each hooks into report
Browse files Browse the repository at this point in the history
  • Loading branch information
just-boris committed Sep 3, 2015
1 parent 6d8b599 commit c26d048
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ function AllureReporter(runner, opts) {
}
allureReporter.endCase(status, err);
});

runner.on("hook end", function(hook) {
if(hook.title.indexOf('"after each" hook') === 0) {
allureReporter.endCase("passed");
}
});
}

module.exports = AllureReporter;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"sinon-chai": "^2.7.0"
},
"dependencies": {
"allure-js-commons": "1.0.2",
"allure-js-commons": "1.0.3",
"mocha": "^2.2.4"
}
}
21 changes: 21 additions & 0 deletions test/fixtures/hooks.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
describe("Hooks tests", function() {
describe("broken teardown", function() {
beforeEach(function() {});
it("a test", function() {});
it("a second test", function() {});

afterEach("broken afterEach", function() {
throw new Error("I am broken");
});
});

describe("broken setup", function() {
beforeEach(function() {
throw new Error("You shall not pass");
});

it("a test", function() {});
})

afterEach("passing afterEach", function() {});
});
4 changes: 1 addition & 3 deletions test/fixtures/simple.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ describe("A mocha suite", function() {
}),
firstStep = allure.createStep("simple step", function() {});

beforeEach(function() {

});
beforeEach(function() {});

describe("passing", function() {
it("simple test", function() {
Expand Down

0 comments on commit c26d048

Please sign in to comment.