Skip to content

Commit

Permalink
Feature/exit code fix (#119)
Browse files Browse the repository at this point in the history
* remove babel-polyfill

* pass failures through to mocha done function
  • Loading branch information
adamgruber authored Jan 17, 2017
1 parent 4e4635c commit 088dd42
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
10 changes: 5 additions & 5 deletions dist/mochawesome.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var _typeof3 = _interopRequireDefault(_typeof2);
*/

var done = function () {
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(output, config, exit) {
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(output, config, failures, exit) {
var reportJsonFile, reportHtmlFile;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
Expand All @@ -46,7 +46,7 @@ var done = function () {
case 7:
log('Report HTML saved to ' + reportHtmlFile, null, config);

exit();
exit(failures);
_context.next = 15;
break;

Expand All @@ -55,7 +55,7 @@ var done = function () {
_context.t0 = _context['catch'](1);

log(_context.t0, 'error', config);
exit();
exit(failures);

case 15:
case 'end':
Expand All @@ -65,7 +65,7 @@ var done = function () {
}, _callee, this, [[1, 11]]);
}));

return function done(_x, _x2, _x3) {
return function done(_x, _x2, _x3, _x4) {
return _ref.apply(this, arguments);
};
}();
Expand Down Expand Up @@ -338,7 +338,7 @@ function saveFile(filename, data) {
// Done function will be called before mocha exits
// This is where we will save JSON and generate the report
this.done = function (failures, exit) {
return done(_this.output, _this.config, exit);
return done(_this.output, _this.config, failures, exit);
};

// Reset total tests counter
Expand Down
8 changes: 4 additions & 4 deletions src/mochawesome.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function saveFile(filename, data) {
* @param {Function} exit
*/

async function done(output, config, exit) {
async function done(output, config, failures, exit) {
const { reportJsonFile, reportHtmlFile } = config;
try {
// Save the JSON to disk
Expand All @@ -300,10 +300,10 @@ async function done(output, config, exit) {
await marge.create(output, config);
log(`Report HTML saved to ${reportHtmlFile}`, null, config);

exit();
exit(failures);
} catch (err) {
log(err, 'error', config);
exit();
exit(failures);
}
}

Expand All @@ -317,7 +317,7 @@ async function done(output, config, exit) {
function Mochawesome(runner, options) {
// Done function will be called before mocha exits
// This is where we will save JSON and generate the report
this.done = (failures, exit) => done(this.output, this.config, exit);
this.done = (failures, exit) => done(this.output, this.config, failures, exit);

// Reset total tests counter
totalTestsRegistered = 0;
Expand Down
1 change: 0 additions & 1 deletion test-functional/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
--stack-trace
--compilers js:babel-core/register
--require babel-polyfill
--require should
--reporter mochawesome

0 comments on commit 088dd42

Please sign in to comment.