[Pkg-javascript-commits] [node-browser-pack] 71/141: adding test to show that nomap flag is respected

Bastien Roucariès rouca at moszumanska.debian.org
Thu May 4 10:23:26 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-browser-pack.

commit 23a591eb5b977f5aa7e8399761572b2cfa5b524a
Author: Thorsten Lorenz <thlorenz at gmx.de>
Date:   Fri Nov 1 15:20:12 2013 -0400

    adding test to show that nomap flag is respected
---
 test/source-maps.js | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/test/source-maps.js b/test/source-maps.js
index 9c7aaa8..d03383e 100644
--- a/test/source-maps.js
+++ b/test/source-maps.js
@@ -111,3 +111,40 @@ test('pack two files without source file field', function (t) {
         }
     ]));
 });
+
+test('pack two files with source file field, one with nomap flag', function (t) {
+    t.plan(7);
+    
+    var p = pack();
+    var src = '';
+    p.on('data', function (buf) { src += buf });
+    p.on('end', function () {
+        var r = Function(['T'], 'return ' + src)(t);
+        t.equal(r('xyz')(5), 555);
+        t.equal(r('xyz')(5), 555);
+
+        var lastLine = grabLastLine(src);
+        var sm = grabSourceMap(lastLine);
+
+        t.ok(/^\/\/@ sourceMappingURL/.test(lastLine), 'contains source mapping url as last line');
+        t.deepEqual(sm.sources, [ 'wunder/bar.js' ], 'includes mappings for only the file without the "nomap" flag');
+        t.equal(sm.mappings, ';AAAA', 'adds offset mapping for each line of mapped file' );
+        t.end()
+    });
+    
+    p.end(JSON.stringify([
+        {
+            id: 'abc',
+            source: 'T.equal(require("./xyz")(3), 333)',
+            entry: true,
+            deps: { './xyz': 'xyz' },
+            sourceFile: 'wunder/bar.js'
+        },
+        {
+            id: 'xyz',
+            source: 'T.ok(true);\nmodule.exports=function(n){\n return n*111 \n}',
+            sourceFile: 'foo.js',
+            nomap: true
+        }
+    ]));
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-browser-pack.git



More information about the Pkg-javascript-commits mailing list