aboutsummaryrefslogtreecommitdiff
path: root/test/mocha
diff options
context:
space:
mode:
Diffstat (limited to 'test/mocha')
-rw-r--r--test/mocha/reduce.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/mocha/reduce.js b/test/mocha/reduce.js
index a6c8a752..779dd99f 100644
--- a/test/mocha/reduce.js
+++ b/test/mocha/reduce.js
@@ -246,4 +246,52 @@ describe("test/reduce.js", function() {
"// }",
].join("\n"));
});
+ it("Should reduce test case which differs only in Error.message", function() {
+ var code = [
+ "var a=0;",
+ "try{",
+ "null[function(){}]",
+ "}catch(e){",
+ "for(var i in e.toString())a++",
+ "}",
+ "console.log(a);",
+ ].join("");
+ var result = reduce_test(code, {
+ compress: false,
+ mangle: false,
+ output: {
+ beautify: true,
+ },
+ });
+ if (result.error) throw result.error;
+ assert.strictEqual(result.code.replace(/function \(/g, "function("), (semver.satisfies(process.version, "<=0.10") ? [
+ "// Can't reproduce test failure",
+ "// minify options: {",
+ '// "compress": false,',
+ '// "mangle": false,',
+ '// "output": {',
+ '// "beautify": true',
+ "// }",
+ "// }",
+ ] : [
+ [
+ "try{",
+ "null[function(){}]",
+ "}catch(e){",
+ "console.log(e)",
+ "}",
+ ].join(""),
+ "// output: TypeError: Cannot read property 'function(){}' of null",
+ "// ",
+ "// minify: TypeError: Cannot read property 'function() {}' of null",
+ "// ",
+ "// options: {",
+ '// "compress": false,',
+ '// "mangle": false,',
+ '// "output": {',
+ '// "beautify": true',
+ "// }",
+ "// }",
+ ]).join("\n"));
+ });
});