From 628e2d1019dd76533fa1fd2ff72f585f5b08c736 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Wed, 27 Jun 2018 14:55:20 +0200 Subject: [PATCH] chore(test/matchers): improve jsonEquals matcher --- test/matchers/JSONMatcher.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/matchers/JSONMatcher.js b/test/matchers/JSONMatcher.js index 9dc38a50..c34b24f7 100644 --- a/test/matchers/JSONMatcher.js +++ b/test/matchers/JSONMatcher.js @@ -1,16 +1,16 @@ export default function(chai, utils) { - utils.addMethod(chai.Assertion.prototype, 'jsonEqual', function(comparison) { + utils.addMethod(chai.Assertion.prototype, 'jsonEqual', function(comparison, filter) { - var actual = JSON.stringify(this._obj); - var expected = JSON.stringify(comparison); + var actual = JSON.stringify(this._obj, filter, ' '); + var expected = JSON.stringify(comparison, filter, ' '); this.assert( actual == expected, - 'expected #{this} to deep equal #{act}', - 'expected #{this} not to deep equal #{act}', - comparison, // expected - this._obj, // actual + 'expected #{this} to json equal #{exp} but got #{act}', + 'expected #{this} not to json equal #{exp}', + expected, // expected + actual, // actual true // show diff ); });