aboutsummaryrefslogtreecommitdiff
path: root/test/mocha
diff options
context:
space:
mode:
authorLucas Wiener <lucas@wiener.se>2016-07-27 16:02:33 +0200
committerRichard van Velzen <rvanvelzen1@gmail.com>2016-08-14 21:40:14 +0200
commit85a09fc3b69cd4ea4b01151e235815b0796373f3 (patch)
tree7456c9e7d6e5009a53088b9ee7fb6beb1ff735f2 /test/mocha
parent307b88d6ccecf3de4150450ac651594db1b8ba56 (diff)
downloadtracifyjs-85a09fc3b69cd4ea4b01151e235815b0796373f3.tar.gz
tracifyjs-85a09fc3b69cd4ea4b01151e235815b0796373f3.zip
Added test for #1236
Diffstat (limited to 'test/mocha')
-rw-r--r--test/mocha/input/issue-1236/simple.js8
-rw-r--r--test/mocha/input/issue-1236/simple.js.map8
-rw-r--r--test/mocha/minify.js16
3 files changed, 32 insertions, 0 deletions
diff --git a/test/mocha/input/issue-1236/simple.js b/test/mocha/input/issue-1236/simple.js
new file mode 100644
index 00000000..8bdd7f26
--- /dev/null
+++ b/test/mocha/input/issue-1236/simple.js
@@ -0,0 +1,8 @@
+"use strict";
+
+var foo = function foo(x) {
+ return "foo " + x;
+};
+console.log(foo("bar"));
+
+//# sourceMappingURL=simple.js.map
diff --git a/test/mocha/input/issue-1236/simple.js.map b/test/mocha/input/issue-1236/simple.js.map
new file mode 100644
index 00000000..28989e0f
--- /dev/null
+++ b/test/mocha/input/issue-1236/simple.js.map
@@ -0,0 +1,8 @@
+{
+ "version": 3,
+ "sources": ["index.js"],
+ "names": [],
+ "mappings": ";;AAAA,IAAI,MAAM,SAAN,GAAM;AAAA,SAAK,SAAS,CAAd;AAAA,CAAV;AACA,QAAQ,GAAR,CAAY,IAAI,KAAJ,CAAZ",
+ "file": "simple.js",
+ "sourcesContent": ["let foo = x => \"foo \" + x;\nconsole.log(foo(\"bar\"));"]
+}
diff --git a/test/mocha/minify.js b/test/mocha/minify.js
index 02d31558..b6e7a23f 100644
--- a/test/mocha/minify.js
+++ b/test/mocha/minify.js
@@ -59,4 +59,20 @@ describe("minify", function() {
'a["foo"]="bar",a.a="red",x={"bar":10};');
});
});
+
+ describe("inSourceMap", function() {
+ it("Should read the given string filename correctly when sourceMapIncludeSources is enabled (#1236)", function() {
+ var result = Uglify.minify('./test/mocha/input/issue-1236/simple.js', {
+ outSourceMap: "simple.js.min.map",
+ inSourceMap: "./test/mocha/input/issue-1236/simple.js.map",
+ sourceMapIncludeSources: true
+ });
+
+ var map = JSON.parse(result.map);
+
+ assert.equal(map.sourcesContent.length, 1);
+ assert.equal(map.sourcesContent[0],
+ 'let foo = x => "foo " + x;\nconsole.log(foo("bar"));');
+ });
+ });
});