From a15f218e9bf8cd5813ee678fea65e2e7fffc86cb Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sun, 8 Feb 2015 01:26:46 +1100 Subject: [PATCH] dump code to esvalid errors --- test/_helper.js | 4 ++-- test/_transformation-helper.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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) {