Catch errors when compression test fails to parse

This commit is contained in:
Anthony Van de Gejuchte
2016-06-08 20:11:32 +02:00
committed by Richard van Velzen
parent 8287ef6781
commit 31d5825a86

View File

@@ -159,9 +159,16 @@ function run_compress_tests() {
function parse_test(file) {
var script = fs.readFileSync(file, "utf8");
var ast = U.parse(script, {
filename: file
});
// TODO try/catch can be removed after fixing https://github.com/mishoo/UglifyJS2/issues/348
try {
var ast = U.parse(script, {
filename: file
});
} catch (e) {
console.log("Caught error while parsing tests in " + file + "\n");
console.log(e);
throw e;
}
var tests = {};
var tw = new U.TreeWalker(function(node, descend){
if (node instanceof U.AST_LabeledStatement