Skip to content

Commit

Permalink
fix: Properly output error stack
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers committed Jun 22, 2017
1 parent 57ec9d7 commit 56f1867
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/core/base/audit.js
Expand Up @@ -165,7 +165,7 @@ Audit.prototype.run = function (context, options, resolve, reject) {
result: axe.constants.CANTTELL,
description: 'An error occured while running this rule',
message: err.message,
help: err.stack || err.message,
stack: err.stack,
error: err
});
res(errResult);
Expand Down
7 changes: 5 additions & 2 deletions test/core/base/audit.js
Expand Up @@ -496,6 +496,7 @@ describe('Audit', function () {
});

it('catches errors and passes them as a cantTell result', function (done) {
var err = new Error('Launch the super sheep!');
a.addRule({
id: 'throw1',
selector: '*',
Expand All @@ -506,7 +507,7 @@ describe('Audit', function () {
a.addCheck({
id: 'throw1-check1',
evaluate: function () {
throw new Error('Launch the super sheep!');
throw err;
}
});

Expand All @@ -518,7 +519,9 @@ describe('Audit', function () {
}, function (results) {
assert.lengthOf(results,1);
assert.equal(results[0].result, 'cantTell');
assert.equal(results[0].error.message, 'Launch the super sheep!');
assert.equal(results[0].message, err.message);
assert.equal(results[0].stack, err.stack);
assert.equal(results[0].error, err);
done();
}, isNotCalled);
});
Expand Down

0 comments on commit 56f1867

Please sign in to comment.