improve error messages (#1506)
- better inheritance of `Error` sub-classes - mark parse error against source in CLI closes #235 closes #348 closes #524 closes #1356 closes #1405
This commit is contained in:
@@ -110,7 +110,7 @@ describe("minify", function() {
|
||||
inSourceMap: "inline",
|
||||
sourceMapInline: true
|
||||
});
|
||||
}, "multiple input and inline source map");
|
||||
});
|
||||
});
|
||||
it("Should fail with SpiderMonkey and inline source map", function() {
|
||||
assert.throws(function() {
|
||||
@@ -119,7 +119,7 @@ describe("minify", function() {
|
||||
sourceMapInline: true,
|
||||
spidermonkey: true
|
||||
});
|
||||
}, "SpiderMonkey and inline source map");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -156,4 +156,19 @@ describe("minify", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("JS_Parse_Error", function() {
|
||||
it("should throw syntax error", function() {
|
||||
assert.throws(function() {
|
||||
Uglify.minify("function f(a{}", { fromString: true });
|
||||
}, function(err) {
|
||||
assert.ok(err instanceof Error);
|
||||
assert.strictEqual(err.stack.split(/\n/)[0], "SyntaxError: Unexpected token punc «{», expected punc «,»");
|
||||
assert.strictEqual(err.filename, 0);
|
||||
assert.strictEqual(err.line, 1);
|
||||
assert.strictEqual(err.col, 12);
|
||||
return true;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user