From debc525fa117438d4971df3790f9f476fed65858 Mon Sep 17 00:00:00 2001 From: Richard van Velzen Date: Mon, 20 Jun 2016 16:57:40 +0200 Subject: [PATCH] Introduce a test that tests the --self build --- test/mocha/cli.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/mocha/cli.js diff --git a/test/mocha/cli.js b/test/mocha/cli.js new file mode 100644 index 00000000..38b57cd7 --- /dev/null +++ b/test/mocha/cli.js @@ -0,0 +1,22 @@ +var assert = require("assert"); +var exec = require("child_process").exec; + +describe("bin/uglifyjs", function () { + it("should produce a functional build when using --self", function (done) { + this.timeout(5000); + + var uglifyjs = '"' + process.argv[0] + '" bin/uglifyjs'; + var command = uglifyjs + ' --self -cm --wrap WrappedUglifyJS'; + + exec(command, function (err, stdout) { + if (err) throw err; + + eval(stdout); + + assert.strictEqual(typeof WrappedUglifyJS, 'object'); + assert.strictEqual(true, WrappedUglifyJS.parse('foo;') instanceof WrappedUglifyJS.AST_Node); + + done(); + }); + }); +}); -- 2.34.1