fix CLI output corruption (#2061)

Using `console.error()` & `console.log()` result in inconsistent formatting across Node.js versions.

Avoid this issue by directly writing to `process.stderr` & `process.stdout` instead.

Miscellaneous
- prettify invalid option listing
This commit is contained in:
Alex Lam S.L
2017-06-07 04:25:32 +08:00
committed by GitHub
parent b9ad53d1ab
commit f2af093402
2 changed files with 37 additions and 22 deletions

View File

@@ -542,7 +542,7 @@ describe("bin/uglifyjs", function () {
exec(command, function (err, stdout, stderr) {
assert.ok(err);
assert.strictEqual(stdout, "");
assert.ok(/^Supported options:\n\{[^}]+}\nERROR: `ascii-only` is not a supported option/.test(stderr), stderr);
assert.ok(/^Supported options:\n[\s\S]*?\nERROR: `ascii-only` is not a supported option/.test(stderr), stderr);
done();
});
});