aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mocha/minify-file-map.js14
-rw-r--r--test/mocha/minify.js3
2 files changed, 13 insertions, 4 deletions
diff --git a/test/mocha/minify-file-map.js b/test/mocha/minify-file-map.js
index aa42d25a..169e730e 100644
--- a/test/mocha/minify-file-map.js
+++ b/test/mocha/minify-file-map.js
@@ -7,10 +7,18 @@ describe("Input file as map", function() {
'/scripts/foo.js': 'var foo = {"x": 1, y: 2, \'z\': 3};'
};
var result = Uglify.minify(jsMap, {fromString: true, outSourceMap: true});
-
+
var map = JSON.parse(result.map);
assert.strictEqual(result.code, 'var foo={x:1,y:2,z:3};');
assert.deepEqual(map.sources, ['/scripts/foo.js']);
+ assert.strictEqual(map.file, undefined);
+
+ result = Uglify.minify(jsMap, {fromString: true, outFileName: 'out.js'});
+ assert.strictEqual(result.map, null);
+
+ result = Uglify.minify(jsMap, {fromString: true, outFileName: 'out.js', outSourceMap: true});
+ map = JSON.parse(result.map);
+ assert.strictEqual(map.file, 'out.js');
});
it("Should accept array of objects and strings", function() {
@@ -19,7 +27,7 @@ describe("Input file as map", function() {
'var bar = 15;'
];
var result = Uglify.minify(jsSeq, {fromString: true, outSourceMap: true});
-
+
var map = JSON.parse(result.map);
assert.strictEqual(result.code, 'var foo={x:1,y:2,z:3},bar=15;');
assert.strictEqual(map.sources[0], '/scripts/foo.js');
@@ -31,7 +39,7 @@ describe("Input file as map", function() {
'var bar = 15;'
];
var result = Uglify.minify(jsSeq, {fromString: true, outSourceMap: true, sourceMapIncludeSources: true});
-
+
var map = JSON.parse(result.map);
assert.strictEqual(result.code, 'var foo={x:1,y:2,z:3},bar=15;');
assert.deepEqual(map.sourcesContent, ['var foo = {"x": 1, y: 2, \'z\': 3};', 'var bar = 15;']);
diff --git a/test/mocha/minify.js b/test/mocha/minify.js
index ce5e8497..70cf73ae 100644
--- a/test/mocha/minify.js
+++ b/test/mocha/minify.js
@@ -63,13 +63,14 @@ describe("minify", function() {
describe("inSourceMap", function() {
it("Should read the given string filename correctly when sourceMapIncludeSources is enabled (#1236)", function() {
var result = Uglify.minify('./test/input/issue-1236/simple.js', {
- outSourceMap: "simple.js.min.map",
+ outSourceMap: "simple.min.js.map",
inSourceMap: "./test/input/issue-1236/simple.js.map",
sourceMapIncludeSources: true
});
var map = JSON.parse(result.map);
+ assert.equal(map.file, 'simple.min.js');
assert.equal(map.sourcesContent.length, 1);
assert.equal(map.sourcesContent[0],
'let foo = x => "foo " + x;\nconsole.log(foo("bar"));');