improve usability of global_defs in minify() (#1987)
Use `@key` to `parse()` string value as `AST_Node`. fixes #1986
This commit is contained in:
@@ -181,4 +181,19 @@ describe("minify", function() {
|
||||
assert.strictEqual(err.col, 12);
|
||||
});
|
||||
});
|
||||
|
||||
describe("global_defs", function() {
|
||||
it("should throw for non-trivial expressions", function() {
|
||||
var result = Uglify.minify("alert(42);", {
|
||||
compress: {
|
||||
global_defs: {
|
||||
"@alert": "debugger"
|
||||
}
|
||||
}
|
||||
});
|
||||
var err = result.error;
|
||||
assert.ok(err instanceof Error);
|
||||
assert.strictEqual(err.stack.split(/\n/)[0], "Error: Can't handle expression: debugger");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user