Skip to content
Browse files

Merge pull request #14 from jacobmoe/master

Output nothing if no diff is found
  • Loading branch information...
2 parents 21ed2f3 + 9bff743 commit 31349cad9e9e7adf3f0473e3b759bbd0b9e81689 @andreyvit committed Nov 7, 2015
Showing with 9 additions and 4 deletions.
  1. +3 −1 lib/colorize.iced
  2. +3 −3 package.json
  3. +3 −0 test/diff_test.coffee
View
4 lib/colorize.iced
@@ -52,7 +52,9 @@ subcolorizeToCallback = (key, diff, output, color, indent) ->
output color, "#{indent}]"
else
- output(color, indent + prefix + JSON.stringify(diff))
+ if diff == 0 or diff
+ output(color, indent + prefix + JSON.stringify(diff))
+
colorizeToCallback = (diff, output) ->
View
6 package.json
@@ -11,17 +11,17 @@
"bin": "bin/json-diff.js",
"scripts": {
"test": "./node_modules/mocha/bin/mocha test/*.coffee",
- "cov": "rm -rf lib-cov; jscoverage lib lib-cov; env JSLIB=lib-cov mocha -R dot && env JSLIB=lib-cov mocha -R html-cov >coverage.html; open coverage.html"
+ "cov": "rm -rf lib-cov; jscoverage lib lib-cov; env JSLIB=lib-cov mocha -R dot && env JSLIB=lib-cov mocha -R html-cov >coverage.html; open coverage.html"
},
"dependencies": {
"dreamopt": "~0.6.0",
"difflib": "~0.2.1",
"cli-color": "~0.1.6"
},
"devDependencies": {
- "mocha": "~1.7.0",
"coffee-script": "~1.7.1",
- "iced-coffee-script": "~1.7.1"
+ "iced-coffee-script": "^1.8.0-d",
+ "mocha": "~1.7.0"
},
"optionalDependencies": {},
"engines": {
View
3 test/diff_test.coffee
@@ -89,3 +89,6 @@ describe 'diffString', ->
it "should produce the expected colored result for the example JSON files", ->
assert.equal diffString(a, b), readExampleFile('result-colored.jsdiff')
+
+ it "return an empty string when no diff found", ->
+ assert.equal diffString(a, a), ''

0 comments on commit 31349ca

Please sign in to comment.
Something went wrong with that request. Please try again.