diff --git a/test/rendering.test.js b/test/rendering.test.js index af68bbe..a653fa5 100644 --- a/test/rendering.test.js +++ b/test/rendering.test.js @@ -27,9 +27,10 @@ helper.files('rendering', 'mml', function(file) { } else { var result = helper.resultFile(file); renderResult = output; - helper.compareToXMLFile(result, output, function(err) { + helper.compareToXMLFile(result, output, function(err,expected_json,actual_json) { completed = true; - var actual = file + '.actual.xml'; + var actual = file.replace(path.extname(file),'') + '-actual.json'; + var expected = file.replace(path.extname(file),'') + '-expected.json'; if (err) { // disabled since it can break on large diffs /* @@ -40,12 +41,14 @@ helper.files('rendering', 'mml', function(file) { helper.showDifferences(err); throw ''; */ - fs.writeFileSync(actual,output); + fs.writeFileSync(actual,JSON.stringify(actual_json,null,4)); + fs.writeFileSync(expected,JSON.stringify(expected_json,null,4)); throw new Error('failed: ' + actual + ' not equal to expected: ' + result); } else { // cleanup any actual renders that no longer fail try { fs.unlinkSync(actual); + fs.unlinkSync(expected); } catch (err) {} } done(); diff --git a/test/support/helper.js b/test/support/helper.js index 7118773..e267112 100644 --- a/test/support/helper.js +++ b/test/support/helper.js @@ -120,7 +120,7 @@ exports.compareToXMLFile = function(filename, second, callback, processors) { assert.deepEqual(secondXML, firstXML); callback(null); } catch (err) { - callback(err); + callback(err,secondXML, firstXML); } }); });