diff --git a/test/errorhandling.test.js b/test/errorhandling.test.js index 7111b15..7a962ff 100644 --- a/test/errorhandling.test.js +++ b/test/errorhandling.test.js @@ -19,13 +19,17 @@ helper.files('errorhandling', 'mml', function(file) { local_data_dir: path.join(__dirname, 'rendering'), filename: file }).render(mml, function (err) { - var result = helper.resultFile(file); - var output = err.message; - // @TODO for some reason, fs.readFile includes an additional \n - // at the end of read files. Determine why. - fs.readFile(helper.resultFile(file), 'utf8', function(err, data) { - if (!err) assert.deepEqual(output, data.substr(0, data.length - 1)); - }); + if (!err) { + console.warn("*** <--- WARNING invalid error handling test found (" + file + "): all error handling tests should throw errors!"); + } else { + var result = helper.resultFile(file); + var output = err.message; + // @TODO for some reason, fs.readFile includes an additional \n + // at the end of read files. Determine why. + fs.readFile(helper.resultFile(file), 'utf8', function(err, data) { + if (!err) assert.deepEqual(output, data.substr(0, data.length - 1)); + }); + } }); } catch(err) { var result = helper.resultFile(file);