Skip to content

Commit

Permalink
refactor(test): format test failure output
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj authored and benlesh committed Sep 15, 2015
1 parent 5e2ac6d commit daa5f1d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion spec/helpers/test-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,20 @@ beforeEach(function () {
toDeepEqual: function(util, customEqualityTesters) {
return {
compare: function(actual, expected) {
return { pass: _.isEqual(actual, expected) };
var result = { pass: _.isEqual(actual, expected) };

if (!result.pass && Array.isArray(actual) && Array.isArray(expected)) {
result.message = 'Expected \n';
actual.forEach(function(x) {
result.message += JSON.stringify(x) + '\n';
});
result.message += '\nto deep equal \n';
expected.forEach(function(x) {
result.message += JSON.stringify(x) + '\n';
});
}

return result;
}
};
}
Expand Down

0 comments on commit daa5f1d

Please sign in to comment.