[Pkg-javascript-commits] [node-module-deps] 173/444: failing test for transform options

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:47:53 UTC 2017


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

rouca pushed a commit to branch master
in repository node-module-deps.

commit 56f68cf93d1d86917ea8a267f4aef044de4a310c
Author: James Halliday <mail at substack.net>
Date:   Sun Feb 9 14:03:28 2014 -0800

    failing test for transform options
---
 test/tr_opts.js                        | 21 +++++++++++++++++++++
 test/tr_opts/main.js                   |  1 +
 test/tr_opts/node_modules/fff/index.js | 17 +++++++++++++++++
 test/tr_opts/node_modules/ggg/index.js | 17 +++++++++++++++++
 test/tr_opts/package.json              |  6 ++++++
 5 files changed, 62 insertions(+)

diff --git a/test/tr_opts.js b/test/tr_opts.js
new file mode 100644
index 0000000..f0b0048
--- /dev/null
+++ b/test/tr_opts.js
@@ -0,0 +1,21 @@
+var mdeps = require('../');
+var test = require('tape');
+var JSONStream = require('JSONStream');
+var packer = require('browser-pack');
+var concat = require('concat-stream');
+
+test('transform options', function (t) {
+    t.plan(1);
+    var p = mdeps(__dirname + '/tr_opts/main.js', {
+        transformKey: [ 'mdtr' ]
+    });
+    var pack = packer();
+    
+    p.pipe(JSONStream.stringify()).pipe(pack).pipe(concat(function (src) {
+        Function('console', src.toString('utf8'))({
+            log: function (msg) {
+                t.equal(msg, 333);
+            }
+        });
+    }));
+});
diff --git a/test/tr_opts/main.js b/test/tr_opts/main.js
new file mode 100644
index 0000000..1f28407
--- /dev/null
+++ b/test/tr_opts/main.js
@@ -0,0 +1 @@
+console.log(FFF * GGG);
diff --git a/test/tr_opts/node_modules/fff/index.js b/test/tr_opts/node_modules/fff/index.js
new file mode 100644
index 0000000..8a0f5ba
--- /dev/null
+++ b/test/tr_opts/node_modules/fff/index.js
@@ -0,0 +1,17 @@
+var through = require('through');
+
+module.exports = function (file, opts) {
+    var bufs = [];
+    return through(write, end);
+    
+    function write (buf) {
+        if (!Buffer.isBuffer(buf)) buf = Buffer(buf);
+        bufs.push(buf);
+    }
+    
+    function end () {
+        var str = Buffer.concat(bufs).toString('utf8');
+        this.queue(str.replace(/FFF/g, opts.f));
+        this.queue(null);
+    }
+};
diff --git a/test/tr_opts/node_modules/ggg/index.js b/test/tr_opts/node_modules/ggg/index.js
new file mode 100644
index 0000000..fc052e9
--- /dev/null
+++ b/test/tr_opts/node_modules/ggg/index.js
@@ -0,0 +1,17 @@
+var through = require('through');
+
+module.exports = function (file, opts) {
+    var bufs = [];
+    return through(write, end);
+    
+    function write (buf) {
+        if (!Buffer.isBuffer(buf)) buf = Buffer(buf);
+        bufs.push(buf);
+    }
+    
+    function end () {
+        var str = Buffer.concat(bufs).toString('utf8');
+        this.queue(str.replace(/GGG/g, opts.g));
+        this.queue(null);
+    }
+};
diff --git a/test/tr_opts/package.json b/test/tr_opts/package.json
new file mode 100644
index 0000000..6bc52d8
--- /dev/null
+++ b/test/tr_opts/package.json
@@ -0,0 +1,6 @@
+{
+  "mdtr": [
+    [ "fff", { "x": 3 } ],
+    [ "ggg", { "z": 111 } ]
+  ]
+}

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



More information about the Pkg-javascript-commits mailing list