diff --git a/test/input/reduce/diff_error.reduced.js b/test/input/reduce/diff_error.reduced.js index 3002460b..4fed66ef 100644 --- a/test/input/reduce/diff_error.reduced.js +++ b/test/input/reduce/diff_error.reduced.js @@ -1,7 +1,5 @@ // (beautified) -console.log(function() { - return 1 + .1 + .1; -}()); +console.log(1 + .1 + .1); // output: 1.2000000000000002 // // minify: 1.2 diff --git a/test/mocha/comments.js b/test/mocha/comments.js index 830ca107..a2970897 100644 --- a/test/mocha/comments.js +++ b/test/mocha/comments.js @@ -191,7 +191,7 @@ describe("comments", function() { }); it("Should correctly preserve new lines around comments", function() { - var tests = [ + [ [ "// foo", "// bar", diff --git a/test/mocha/glob.js b/test/mocha/glob.js index 0f437c34..926c2f73 100644 --- a/test/mocha/glob.js +++ b/test/mocha/glob.js @@ -1,7 +1,6 @@ var assert = require("assert"); var exec = require("child_process").exec; var path = require("path"); -var readFileSync = require("fs").readFileSync; describe("bin/uglifyjs with input file globs", function() { var uglifyjscmd = '"' + process.argv[0] + '" bin/uglifyjs'; diff --git a/test/mocha/minify.js b/test/mocha/minify.js index f80ada1e..a57f2755 100644 --- a/test/mocha/minify.js +++ b/test/mocha/minify.js @@ -25,7 +25,7 @@ describe("minify", function() { if (result.error) throw result.error; assert.strictEqual(result.code, "print(42);"); assert.strictEqual(JSON.stringify(options), value); - }) + }); it("Should skip inherited keys from `files`", function() { var files = Object.create({ skip: this }); files[0] = "alert(1 + 1)"; diff --git a/test/mocha/reduce.js b/test/mocha/reduce.js index abe4e782..037d3284 100644 --- a/test/mocha/reduce.js +++ b/test/mocha/reduce.js @@ -1,5 +1,4 @@ var assert = require("assert"); -var exec = require("child_process").exec; var fs = require("fs"); var reduce_test = require("../reduce"); var semver = require("semver"); diff --git a/test/mocha/sourcemaps.js b/test/mocha/sourcemaps.js index 32017565..24a60f23 100644 --- a/test/mocha/sourcemaps.js +++ b/test/mocha/sourcemaps.js @@ -362,7 +362,7 @@ describe("sourcemaps", function() { it("Should not modify input source map", function() { var orig = get_map(); var original = JSON.stringify(orig); - var map = prepare_map(orig); + prepare_map(orig); assert.strictEqual(JSON.stringify(orig), original); }); it("Should copy over original sourcesContent", function() { diff --git a/test/mocha/string-literal.js b/test/mocha/string-literal.js index 02747232..a9bac9ff 100644 --- a/test/mocha/string-literal.js +++ b/test/mocha/string-literal.js @@ -12,7 +12,7 @@ describe("String literals", function() { '"\u2029"', ].forEach(function(input) { assert.throws(function() { - var ast = UglifyJS.parse(input); + UglifyJS.parse(input); }, function(e) { return e instanceof UglifyJS.JS_Parse_Error && e.message === "Unterminated string constant"; @@ -44,7 +44,7 @@ describe("String literals", function() { '"use strict";\n"\\011"', ].forEach(function(input) { assert.throws(function() { - var output = UglifyJS.parse(input); + UglifyJS.parse(input); }, function(e) { return e instanceof UglifyJS.JS_Parse_Error && e.message === "Legacy octal escape sequences are not allowed in strict mode"; diff --git a/test/reduce.js b/test/reduce.js index 2a164169..30272de0 100644 --- a/test/reduce.js +++ b/test/reduce.js @@ -215,9 +215,9 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options) // hoist and return expressions from the IIFE function expression var seq = []; node.expression.body.forEach(function(node) { - var expr = expr instanceof U.AST_Exit ? node.value : node.body; + var expr = node instanceof U.AST_Exit ? node.value : node.body; if (expr instanceof U.AST_Node && !U.is_statement(expr) && can_hoist(expr)) { - // collect expressions from each statements' body + // collect expressions from each statement's body seq.push(expr); } }); @@ -395,7 +395,7 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options) var expr = [ node.expression, // switch expression node.body[0] && node.body[0].expression, // first case expression or undefined - node.body[0] && node.body[0], // first case body or undefined + node.body[0], // first case body or undefined ][ (node.start._permute * steps | 0) % 4 ]; node.start._permute += step; if (expr && (!(expr instanceof U.AST_Statement) || !has_loopcontrol(expr, node, parent))) { diff --git a/test/sandbox.js b/test/sandbox.js index 84d7b07b..0ba179e8 100644 --- a/test/sandbox.js +++ b/test/sandbox.js @@ -278,11 +278,11 @@ function run_code_exec(code, toplevel, timeout) { timeout: timeout || 5000, }); if (result.status === 0) return result.stdout; + var msg = ("" + result.stderr).replace(/\r\n/g, "\n"); if (result.error && result.error.code == "ETIMEDOUT" || /FATAL ERROR:/.test(msg)) { return new Error("Script execution timed out."); } if (result.error) return result.error; - var msg = result.stderr.replace(/\r\n/g, "\n"); var end = msg.indexOf("\n\n-----===== UNCAUGHT EXCEPTION =====-----\n\n"); var details; if (end >= 0) { diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js index c27b82a3..9c47dbff 100644 --- a/test/ufuzz/index.js +++ b/test/ufuzz/index.js @@ -2078,8 +2078,8 @@ if (require.main !== module) { return; } -function run_code(code, toplevel) { - return sandbox.run_code(sandbox.patch_module_statements(code), toplevel); +function run_code(code, toplevel, timeout) { + return sandbox.run_code(sandbox.patch_module_statements(code), toplevel, timeout); } function writeln(stream, msg) {