diff options
author | pengzhenqing <pengzhenqing@sensetime.com> | 2016-10-09 14:15:25 +0800 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2016-10-23 21:21:39 +0200 |
commit | e51c6ba38014fc73a4804a69c556d96f777bc0b3 (patch) | |
tree | 6313e745cf0d054514fd4ac201e23885576c1419 /test/mocha/minify.js | |
parent | 6389e52305f0d2e75a7bc6f8703c8d163d04cb99 (diff) | |
download | tracifyjs-e51c6ba38014fc73a4804a69c556d96f777bc0b3.tar.gz tracifyjs-e51c6ba38014fc73a4804a69c556d96f777bc0b3.zip |
Add an option for writing inline source map
Diffstat (limited to 'test/mocha/minify.js')
-rw-r--r-- | test/mocha/minify.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/mocha/minify.js b/test/mocha/minify.js index 2adbadcb..ce5e8497 100644 --- a/test/mocha/minify.js +++ b/test/mocha/minify.js @@ -75,4 +75,23 @@ describe("minify", function() { 'let foo = x => "foo " + x;\nconsole.log(foo("bar"));'); }); }); + + describe("sourceMapInline", function() { + it("should append source map to output js when sourceMapInline is enabled", function() { + var result = Uglify.minify('var a = function(foo) { return foo; };', { + fromString: true, + sourceMapInline: true + }); + var code = result.code; + assert.strictEqual(code, "var a=function(n){return n};\n" + + "//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIj8iXSwibmFtZXMiOlsiYSIsImZvbyJdLCJtYXBwaW5ncyI6IkFBQUEsR0FBSUEsR0FBSSxTQUFTQyxHQUFPLE1BQU9BIn0="); + }); + it("should not append source map to output js when sourceMapInline is not enabled", function() { + var result = Uglify.minify('var a = function(foo) { return foo; };', { + fromString: true + }); + var code = result.code; + assert.strictEqual(code, "var a=function(n){return n};"); + }); + }); }); |