diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-05-28 18:21:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-28 18:21:44 +0800 |
commit | c6c9f4f5a837bea16609b1d430e6c20687f3742b (patch) | |
tree | ceeb632bde5e54dd6c0acb7dafa2ccd3e57ac1e4 /test | |
parent | fec14379f6bae209484d75ba1db5c6b5ee37ae5a (diff) | |
download | tracifyjs-c6c9f4f5a837bea16609b1d430e6c20687f3742b.tar.gz tracifyjs-c6c9f4f5a837bea16609b1d430e6c20687f3742b.zip |
implement `--help options` (#2017)
Diffstat (limited to 'test')
-rw-r--r-- | test/ufuzz.js | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/test/ufuzz.js b/test/ufuzz.js index ff403c60..e3361e38 100644 --- a/test/ufuzz.js +++ b/test/ufuzz.js @@ -12,7 +12,7 @@ stream._handle.setBlocking(true); }); -var UglifyJS = require("./node"); +var UglifyJS = require(".."); var randomBytes = require("crypto").randomBytes; var sandbox = require("./sandbox"); @@ -962,32 +962,15 @@ function try_beautify(code, result) { console.log(code); } -function infer_options(ctor) { - try { - ctor({ 0: 0 }); - } catch (e) { - return e.defs; - } -} - -var default_options = { - compress: infer_options(UglifyJS.Compressor), - mangle: { - "cache": null, - "eval": false, - "ie8": false, - "keep_fnames": false, - "toplevel": false, - }, - output: infer_options(UglifyJS.OutputStream), -}; +var default_options = UglifyJS.default_options(); function log_suspects(minify_options, component) { var options = component in minify_options ? minify_options[component] : true; if (!options) return; - options = UglifyJS.defaults(options, default_options[component]); - var suspects = Object.keys(default_options[component]).filter(function(name) { - if (options[name]) { + if (typeof options != "object") options = {}; + var defs = default_options[component]; + var suspects = Object.keys(defs).filter(function(name) { + if ((name in options ? options : defs)[name]) { var m = JSON.parse(JSON.stringify(minify_options)); var o = JSON.parse(JSON.stringify(options)); o[name] = false; |