diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-01-07 08:53:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-07 16:53:29 +0800 |
commit | 6c419bc083e097337960f1a19d2c352336d75e16 (patch) | |
tree | 87febc2499af74b116f8d4b0e5fb76a910f10291 /test | |
parent | 25321df959eb7aac7bd144be428a0aea0d29a0b9 (diff) | |
download | tracifyjs-6c419bc083e097337960f1a19d2c352336d75e16.tar.gz tracifyjs-6c419bc083e097337960f1a19d2c352336d75e16.zip |
implement `UGLIFY_BUG_REPORT` (#4516)
Diffstat (limited to 'test')
-rw-r--r-- | test/mocha/bug-report.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/mocha/bug-report.js b/test/mocha/bug-report.js new file mode 100644 index 00000000..480850df --- /dev/null +++ b/test/mocha/bug-report.js @@ -0,0 +1,40 @@ +var assert = require("assert"); +var exec = require("child_process").exec; + +describe("UGLIFY_BUG_REPORT", function() { + var env = Object.create(process.env); + env.UGLIFY_BUG_REPORT = 1; + it("Should generate bug report via API", function(done) { + exec('"' + process.argv[0] + '"', { env: env }, function(err, stdout) { + if (err) throw err; + assert.strictEqual(stdout, [ + "// UGLIFY_BUG_REPORT", + "// <<undefined>>", + "", + "//-------------------------------------------------------------", + "// INPUT CODE", + "...---...", + "", + ].join("\n")); + done(); + }).stdin.end('console.log(require("./").minify("...---...").code);'); + }); + it("Should generate bug report via CLI", function(done) { + exec('"' + process.argv[0] + '" bin/uglifyjs -mc', { env: env }, function(err, stdout) { + if (err) throw err; + assert.strictEqual(stdout, [ + "// UGLIFY_BUG_REPORT", + "// {", + '// "mangle": {},', + '// "compress": {}', + "// }", + "", + "//-------------------------------------------------------------", + "// STDIN", + "...---...", + "", + ].join("\n")); + done(); + }).stdin.end("...---..."); + }); +}); |