Catch errors when compression test fails to parse
authorAnthony Van de Gejuchte <anthonyvdgent@gmail.com>
Wed, 8 Jun 2016 18:11:32 +0000 (20:11 +0200)
committerRichard van Velzen <rvanvelzen@experty.com>
Thu, 9 Jun 2016 19:12:15 +0000 (21:12 +0200)
test/run-tests.js

index 0a249b9..6614b2a 100755 (executable)
@@ -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