[Pkg-javascript-commits] [node-browser-pack] 75/141: sourceMapPrefix test
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 6ba80094cfb2efb74859dcdb9f643f2e2e4d5725
Author: James Halliday <mail at substack.net>
Date: Mon Nov 18 16:00:39 2013 +0800
sourceMapPrefix test
---
test/source-maps.js | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/test/source-maps.js b/test/source-maps.js
index dceb2e2..c15c7cb 100644
--- a/test/source-maps.js
+++ b/test/source-maps.js
@@ -148,3 +148,38 @@ test('pack two files with source file field, one with nomap flag', function (t)
}
]));
});
+
+test('custom sourceMapPrefix for //@', function (t) {
+ t.plan(7);
+
+ var p = pack({ sourceMapPrefix: '//@' });
+ 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, [ 'foo.js' ], 'includes mappings for sourceFile only');
+ t.equal(sm.mappings, ';;;AAAA;AACA;AACA;AACA', 'adds offset mapping for each line' );
+ });
+
+ p.end(JSON.stringify([
+ {
+ id: 'abc',
+ source: 'T.equal(require("./xyz")(3), 333)',
+ entry: true,
+ deps: { './xyz': 'xyz' }
+ },
+ {
+ id: 'xyz',
+ source: 'T.ok(true);\nmodule.exports=function(n){\n return n*111 \n}',
+ sourceFile: 'foo.js'
+ }
+ ]));
+});
+
--
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