fix & enhance collapse_vars (#4447)

fixes #4446
This commit is contained in:
Alex Lam S.L
2020-12-24 09:02:18 +00:00
committed by GitHub
parent 5f269cd573
commit 1896694532
7 changed files with 125 additions and 27 deletions

View File

@@ -1680,18 +1680,20 @@ function log(options) {
}
}
errorln("//-------------------------------------------------------------");
var reduce_options = JSON.parse(options);
reduce_options.validate = true;
var reduced = reduce_test(original_code, reduce_options, {
verbose: false,
}).code;
if (reduced) {
errorln();
errorln("// reduced test case (output will differ)");
errorln();
errorln(reduced);
errorln();
errorln("//-------------------------------------------------------------");
if (!ok) {
var reduce_options = JSON.parse(options);
reduce_options.validate = true;
var reduced = reduce_test(original_code, reduce_options, {
verbose: false,
}).code;
if (reduced) {
errorln();
errorln("// reduced test case (output will differ)");
errorln();
errorln(reduced);
errorln();
errorln("//-------------------------------------------------------------");
}
}
errorln("minify(options):");
errorln(JSON.stringify(JSON.parse(options), null, 2));

View File

@@ -70,7 +70,7 @@ function run() {
function trap(data) {
stderr += data;
if (~stderr.indexOf("\nminify(options):\n")) {
if (~stderr.indexOf("!!!!!! Failed... round ")) {
process.exitCode = 1;
child.stderr.removeListener("data", trap);
}