diff --git a/test/_helper.js b/test/_helper.js index c44d9f672f..657f133804 100644 --- a/test/_helper.js +++ b/test/_helper.js @@ -19,14 +19,14 @@ var readFile = exports.readFile = function (filename) { } }; -exports.esvalid = function (ast, loc) { +exports.esvalid = function (ast, code, loc) { var errors = esvalid.errors(ast); if (errors.length) { var msg = []; _.each(errors, function (err) { msg.push(err.message + " - " + JSON.stringify(err.node)); }); - throw new Error(loc + ": " + msg.join(". ")); + throw new Error(loc + ": " + msg.join(". ") + "\n" + code); } }; diff --git a/test/_transformation-helper.js b/test/_transformation-helper.js index 3d6fb56166..0539c6b79a 100644 --- a/test/_transformation-helper.js +++ b/test/_transformation-helper.js @@ -54,7 +54,7 @@ var run = function (task, done) { var checkAst = function (result, opts) { if (noCheckAst) return; - helper.esvalid(result.ast.program, opts.loc); + helper.esvalid(result.ast.program, result.code, opts.loc); }; if (execCode) {