[Pkg-javascript-commits] [node-tap-mocha-reporter] 53/137: Don't string-diff if they only differ by trimmable whitespace

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 09:49:25 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-tap-mocha-reporter.

commit 39e15d8326bc251614a8a01b612119e65f8b26e2
Author: isaacs <i at izs.me>
Date:   Wed May 6 11:36:39 2015 -0700

    Don't string-diff if they only differ by trimmable whitespace
---
 lib/reporters/classic.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/reporters/classic.js b/lib/reporters/classic.js
index 3ad4e91..d6b1ca5 100644
--- a/lib/reporters/classic.js
+++ b/lib/reporters/classic.js
@@ -131,8 +131,11 @@ function doDiff (found, wanted, palette) {
     maxLen = 0
   }
 
+  // If they are not strings, or only differ in trailing whitespace,
+  // then stringify them so that we can see the difference.
   if (typeof found !== 'string' ||
-      typeof wanted !== 'string') {
+      typeof wanted !== 'string' ||
+      found.trim() === wanted.trim()) {
     found = utils.stringify(found)
     wanted = utils.stringify(wanted)
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-tap-mocha-reporter.git



More information about the Pkg-javascript-commits mailing list