diff --git a/package.json b/package.json index 0c66b77..b4d7883 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "atom-space-pen-views": "^2.0.3", "bluebird": "^2.9.25", "coffee-formatter": "^0.1.1", + "diff": "^1.3.2", "editorconfig": "^0.11.4", "emissary": "^1.0.0", "expand-home-dir": "0.0.2", diff --git a/spec/beautify-languages-spec.coffee b/spec/beautify-languages-spec.coffee index 3017692..2bc5d78 100644 --- a/spec/beautify-languages-spec.coffee +++ b/spec/beautify-languages-spec.coffee @@ -3,6 +3,7 @@ Beautifiers = require "../src/beautifiers" beautifier = new Beautifiers() fs = require "fs" path = require "path" +JsDiff = require('diff') # Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs. # @@ -135,9 +136,18 @@ describe "BeautifyLanguages", -> if text instanceof Error return beautifyCompleted = text # text == Error expect(typeof text).toEqual "string" + # Check for beautification errors if text isnt expectedContents - console.warn(allOptions, text, expectedContents) - expect(text).toEqual expectedContents + # console.warn(allOptions, text, expectedContents) + fileName = originalTestPath + oldStr=text + newStr=expectedContents + oldHeader="original" + newHeader="expected" + diff = JsDiff.createPatch(fileName, oldStr, newStr, oldHeader, newHeader) + throw new Error("Beautifier output does not match expected output:\n"+diff) + #expect(text).toEqual expectedContents + # All done! beautifyCompleted = true runs ->