[Pkg-javascript-commits] [node-module-deps] 137/444: failing test for global transforms

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:47:50 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 23478134575607d85ac21b79e167b345b7407873
Author: James Halliday <mail at substack.net>
Date:   Sat Dec 28 17:52:39 2013 -0800

    failing test for global transforms
---
 test/files/tr_global/main.js                    |  1 +
 test/files/tr_global/node_modules/tr-a/index.js |  7 ++++++
 test/files/tr_global/node_modules/tr-b/index.js |  7 ++++++
 test/files/tr_global/node_modules/tr-c/index.js |  7 ++++++
 test/files/tr_global/node_modules/tr-d/index.js |  7 ++++++
 test/files/tr_global/node_modules/tr-e/index.js |  7 ++++++
 test/files/tr_global/node_modules/tr-f/index.js |  7 ++++++
 test/files/tr_global/package.json               |  5 +++++
 test/tr_global.js                               | 30 +++++++++++++++++++++++++
 9 files changed, 78 insertions(+)

diff --git a/test/files/tr_global/main.js b/test/files/tr_global/main.js
new file mode 100644
index 0000000..4939318
--- /dev/null
+++ b/test/files/tr_global/main.js
@@ -0,0 +1 @@
+console.log(AAA + BBB + CCC + DDD + EEE + FFF);
diff --git a/test/files/tr_global/node_modules/tr-a/index.js b/test/files/tr_global/node_modules/tr-a/index.js
new file mode 100644
index 0000000..dbe6f79
--- /dev/null
+++ b/test/files/tr_global/node_modules/tr-a/index.js
@@ -0,0 +1,7 @@
+var through = require('through');
+
+module.exports = function (file) {
+    return through(function (buf) {
+        this.queue(buf.toString().replace(/AAA/g, '1'));
+    });
+};
diff --git a/test/files/tr_global/node_modules/tr-b/index.js b/test/files/tr_global/node_modules/tr-b/index.js
new file mode 100644
index 0000000..21012c6
--- /dev/null
+++ b/test/files/tr_global/node_modules/tr-b/index.js
@@ -0,0 +1,7 @@
+var through = require('through');
+
+module.exports = function (file) {
+    return through(function (buf) {
+        this.queue(buf.toString().replace(/BBB/g, '10'));
+    });
+};
diff --git a/test/files/tr_global/node_modules/tr-c/index.js b/test/files/tr_global/node_modules/tr-c/index.js
new file mode 100644
index 0000000..320718a
--- /dev/null
+++ b/test/files/tr_global/node_modules/tr-c/index.js
@@ -0,0 +1,7 @@
+var through = require('through');
+
+module.exports = function (file) {
+    return through(function (buf) {
+        this.queue(buf.toString().replace(/CCC/g, '100'));
+    });
+};
diff --git a/test/files/tr_global/node_modules/tr-d/index.js b/test/files/tr_global/node_modules/tr-d/index.js
new file mode 100644
index 0000000..0054380
--- /dev/null
+++ b/test/files/tr_global/node_modules/tr-d/index.js
@@ -0,0 +1,7 @@
+var through = require('through');
+
+module.exports = function (file) {
+    return through(function (buf) {
+        this.queue(buf.toString().replace(/DDD/g, '1000'));
+    });
+};
diff --git a/test/files/tr_global/node_modules/tr-e/index.js b/test/files/tr_global/node_modules/tr-e/index.js
new file mode 100644
index 0000000..5f9b778
--- /dev/null
+++ b/test/files/tr_global/node_modules/tr-e/index.js
@@ -0,0 +1,7 @@
+var through = require('through');
+
+module.exports = function (file) {
+    return through(function (buf) {
+        this.queue(buf.toString().replace(/EEE/g, '10000'));
+    });
+};
diff --git a/test/files/tr_global/node_modules/tr-f/index.js b/test/files/tr_global/node_modules/tr-f/index.js
new file mode 100644
index 0000000..0a4a8cd
--- /dev/null
+++ b/test/files/tr_global/node_modules/tr-f/index.js
@@ -0,0 +1,7 @@
+var through = require('through');
+
+module.exports = function (file) {
+    return through(function (buf) {
+        this.queue(buf.toString().replace(/FFF/g, '100000'));
+    });
+};
diff --git a/test/files/tr_global/package.json b/test/files/tr_global/package.json
new file mode 100644
index 0000000..08b4f71
--- /dev/null
+++ b/test/files/tr_global/package.json
@@ -0,0 +1,5 @@
+{
+  "browserify": {
+    "transform": [ "tr-a", "tr-b" ]
+  }
+}
diff --git a/test/tr_global.js b/test/tr_global.js
new file mode 100644
index 0000000..459a167
--- /dev/null
+++ b/test/tr_global.js
@@ -0,0 +1,30 @@
+var mdeps = require('../');
+var test = require('tap').test;
+var JSONStream = require('JSONStream');
+var packer = require('browser-pack');
+
+test('global transforms', function (t) {
+    t.plan(1);
+    
+    var p = mdeps(__dirname + '/files/tr_global/main.js', {
+        transform: [ 'tr-c', 'tr-d' ],
+        globalTransform: [
+            __dirname + '/files/tr_global/tr-e',
+            __dirname + '/files/tr_global/tr-f'
+        ],
+        transformKey: [ 'browserify', 'transform' ]
+    });
+    var pack = packer();
+    
+    p.pipe(JSONStream.stringify()).pipe(pack);
+    
+    var src = '';
+    pack.on('data', function (buf) { src += buf });
+    pack.on('end', function () {
+        Function(['console','t'], src)(t, {
+            log: function (msg) {
+                t.equal(msg, '111111');
+            }
+        });
+    });
+});

-- 
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