Skip to content

Commit

Permalink
Update: More detailed assert message for rule-tester
Browse files Browse the repository at this point in the history
  • Loading branch information
starkwang committed Dec 25, 2017
1 parent cbf0fb9 commit 549e40a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/testers/rule-tester.js
Expand Up @@ -138,7 +138,16 @@ const IT = Symbol("it");
* @returns {any} Returned value of `method`.
*/
function defaultHandler(text, method) {
return method.apply(this);
try {
return method.apply(this);
} catch (e) {
// options.message should not be passed, otherwise the diff message will be lost.
throw new assert.AssertionError({
actual: e.actual,
expected: e.expected,
operator: e.operator
});
}
}

class RuleTester {
Expand Down

0 comments on commit 549e40a

Please sign in to comment.