aboutsummaryrefslogtreecommitdiff
path: root/test/mocha/minify-file-map.js
blob: cffb2c623990dfdcb0d796ad9a6e0f654cd978f3 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var assert = require("assert");
var UglifyJS = require("../..");

describe("Input file as map", function() {
    it("Should accept object", function() {
        var jsMap = {
            '/scripts/foo.js': 'var foo = {"x": 1, y: 2, \'z\': 3};'
        };
        var result = UglifyJS.minify(jsMap, {sourceMap: 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 = UglifyJS.minify(jsMap);
        assert.strictEqual(result.map, undefined);

        result = UglifyJS.minify(jsMap, {sourceMap: {filename: 'out.js'}});
        map = JSON.parse(result.map);
        assert.strictEqual(map.file, 'out.js');
    });

    it("Should accept array of strings", function() {
        var jsSeq = [
            'var foo = {"x": 1, y: 2, \'z\': 3};',
            'var bar = 15;'
        ];
        var result = UglifyJS.minify(jsSeq, {sourceMap: true});

        var map = JSON.parse(result.map);
        assert.strictEqual(result.code, 'var foo={x:1,y:2,z:3},bar=15;');
        assert.deepEqual(map.sources, ['0', '1']);
    });

    it("Should correctly include source", function() {
        var jsMap = {
            '/scripts/foo.js': 'var foo = {"x": 1, y: 2, \'z\': 3};'
        };
        var result = UglifyJS.minify(jsMap, {sourceMap: {includeSources: true}});

        var map = JSON.parse(result.map);
        assert.strictEqual(result.code, 'var foo={x:1,y:2,z:3};');
        assert.deepEqual(map.sourcesContent, ['var foo = {"x": 1, y: 2, \'z\': 3};']);
    });
});
>2017-12-06Update NEWS.Ludovic Courtès 2017-12-06Update NEWS.Ludovic Courtès 2017-12-05Update NEWS.Ludovic Courtès 2017-12-04Update NEWS.Ludovic Courtès 2017-05-22Update NEWS.Ludovic Courtès 2017-05-21Update NEWS.Ludovic Courtès 2017-05-20Update NEWS.Ricardo Wurmus 2017-05-17Update NEWS.Ricardo Wurmus 2017-05-16Update NEWS.Ludovic Courtès 2016-12-20Update NEWS....Co-authored-by: Ludovic Courtès <ludo@gnu.org> Ricardo Wurmus 2016-08-04Update NEWS.Ludovic Courtès 2016-08-01Update NEWS.Ludovic Courtès 2016-04-18emacs: Add interface for package locations....* emacs/guix-main.scm (%package-location-param-alist): New variable. (package-location->sexp, package-location-entries): New procedures. * emacs/guix-ui-location.el: New file. * emacs.am (ELFILES): Add it. * doc/emacs.texi (Emacs Package Locations): Document 'guix-locations'. * NEWS: Mention it. Alex Kost 2016-03-28Update NEWS.Ludovic Courtès 2016-03-27Update 'NEWS'.Ludovic Courtès 2016-03-02utils: Use '@' for separating package names and version numbers....This provides the ability to use numbers in package names. Fixes <http://bugs.gnu.org/19219>. * guix/utils.scm (package-name->name+version): New procedure. * gnu/packages.scm (%find-package): Add a FALLBACK? keyword argument. Use the previous method when no package is found. (specification->package+output, specification->package): Adapt documentation to new syntax. * doc/guix.texi (Invoking guix package, Invoking guix import): Likewise. * guix/ui.scm (package-specification->name+version+output): Likewise. * guix/scripts/import/hackage.scm (show-help): Likewise. * tests/guix-build.sh: Adapt to new syntax. * tests/guix-lint.sh: Likewise. * tests/guix-package.sh: Likewise. * tests/ui.scm ("package-specification->name+version+output"): Likewise. * tests/utils.scm ("package-name->name+version"): Likewise. * NEWS: Mention new syntax. Mathieu Lirzin 2016-01-25emacs: Add interface for licenses....* emacs/guix-main.scm (%license-param-alist): New variable. (license->sexp, find-licenses, license-entries): New procedures. * emacs/guix-license.el (guix-license-get-entries) (guix-license-get-display, guix-license-insert-packages-button) (guix-license-insert-comment, guix-license-list-describe) (guix-license-list-show-packages): New procedures. (guix-licenses): New command. * doc/emacs.texi (Emacs Licenses): New node. (Emacs Interface): Add it. * doc/guix.texi (Top): Add it. * NEWS: Mention new interface. Alex Kost 2016-01-25emacs: Rename 'file-path' to 'file-name'....* emacs/guix-info.el (guix-info-file-path): Rename to... (guix-info-file-name): ... this. * emacs/guix-list.el (guix-list-file-path): Rename to... (guix-list-file-name): ... this. (guix-list-get-file-path): Rename to... (guix-list-get-file-name): ... this. * emacs/guix-ui-generation.el (guix-generation-list-format): Adjust accordingly. * emacs/guix-ui-system-generation.el (guix-system-generation-list-format): Likewise. * NEWS: Mention faces renaming. Alex Kost 2016-01-16emacs: Add interface for system generations....* emacs/guix-main.scm (system-generation-boot-parameters) (system-generation-param-alist, system-generation-sexps): New procedures. (entries): Add 'system-generation' entry type. * emacs/guix-messages.el (guix-result-message): Use the same messages for 'generation' and 'system-generation' entry types. * emacs/guix-ui-system-generation.el: New file. * emacs.am (ELFILES): Add it. * doc/emacs.texi (Emacs Commands): Document new commands. * NEWS: Mention new interface. Alex Kost 2016-01-02Update NEWS....* NEWS: Mention Emacs interface for Hydra and changes in variables. Alex Kost