diff options
author | kzc <kzc@users.noreply.github.com> | 2020-02-05 21:50:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-06 02:50:59 +0000 |
commit | b0040ba6540232687204d125eff021adf11c4efa (patch) | |
tree | e11d708d5a194fb8a498ef9934f4c2e16bcb0007 /bin | |
parent | c93ca6ee5386f824e60bea6563d249c13854f171 (diff) | |
download | tracifyjs-b0040ba6540232687204d125eff021adf11c4efa.tar.gz tracifyjs-b0040ba6540232687204d125eff021adf11c4efa.zip |
implement CLI `--reduce-test` and reduce tests in ufuzz (#3705)
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/uglifyjs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs index 4528b877..2893d87b 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -54,6 +54,7 @@ program.option("--toplevel", "Compress and/or mangle variables in toplevel scope program.option("--verbose", "Print diagnostic messages."); program.option("--warn", "Print warning messages."); program.option("--wrap <name>", "Embed everything as a function with “exports” corresponding to “name” globally."); +program.option("--reduce-test", "Reduce a standalone `console.log` based test case."); program.arguments("[files...]").parseArgv(process.argv); if (program.configFile) { options = JSON.parse(read_file(program.configFile)); @@ -215,7 +216,15 @@ function run() { } catch (ex) { fatal(ex); } - var result = UglifyJS.minify(files, options); + if (program.reduceTest) { + // load on demand - assumes dev tree checked out + var reduce_test = require("../test/reduce"); + var testcase = files[0] || files[Object.keys(files)[0]]; + var result = reduce_test(testcase, options, {verbose: true}); + } + else { + var result = UglifyJS.minify(files, options); + } if (result.error) { var ex = result.error; if (ex.name == "SyntaxError") { |