[Pkg-javascript-commits] [node-module-deps] 37/444: failing module tr test

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:47:41 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 8caa4a33588c333d4811a1e29425552ad2d8998c
Author: James Halliday <mail at substack.net>
Date:   Wed Feb 27 14:33:37 2013 -0800

    failing module tr test
---
 test/files/tr_module/f.js                            |  1 +
 test/files/tr_module/main.js                         |  7 +++++++
 test/files/tr_module/node_modules/g/index.js         |  1 +
 .../node_modules/g/node_modules/insert-ggg/index.js  |  7 +++++++
 test/files/tr_module/node_modules/g/package.json     |  6 ++++++
 .../files/tr_module/node_modules/insert-aaa/index.js |  7 +++++++
 .../files/tr_module/node_modules/insert-bbb/index.js |  7 +++++++
 test/files/tr_module/node_modules/m/index.js         |  3 +++
 test/tr_module.js                                    | 20 ++++++++++++++++++++
 9 files changed, 59 insertions(+)

diff --git a/test/files/tr_module/f.js b/test/files/tr_module/f.js
new file mode 100644
index 0000000..39c9ea4
--- /dev/null
+++ b/test/files/tr_module/f.js
@@ -0,0 +1 @@
+module.exports = function (x) { return x + BBB }
diff --git a/test/files/tr_module/main.js b/test/files/tr_module/main.js
new file mode 100644
index 0000000..084b20e
--- /dev/null
+++ b/test/files/tr_module/main.js
@@ -0,0 +1,7 @@
+var f = require('./f.js');
+var m = require('m');
+var g = require('g');
+
+t.equal(m(f(AAA)), 555, 'transformation scope');
+t.equal(g(3), 333, 'sub-transformation applied');
+t.equal(typeof GGG, 'undefined', 'GGG leak');
diff --git a/test/files/tr_module/node_modules/g/index.js b/test/files/tr_module/node_modules/g/index.js
new file mode 100644
index 0000000..ee3356a
--- /dev/null
+++ b/test/files/tr_module/node_modules/g/index.js
@@ -0,0 +1 @@
+module.exports = function (x) { return x * GGG }
diff --git a/test/files/tr_module/node_modules/g/node_modules/insert-ggg/index.js b/test/files/tr_module/node_modules/g/node_modules/insert-ggg/index.js
new file mode 100644
index 0000000..859c662
--- /dev/null
+++ b/test/files/tr_module/node_modules/g/node_modules/insert-ggg/index.js
@@ -0,0 +1,7 @@
+var through = require('through');
+
+module.exports = function (file) {
+    return through(function (buf) {
+        this.queue(String(buf).replace(/GGG/g, '111');
+    });
+};
diff --git a/test/files/tr_module/node_modules/g/package.json b/test/files/tr_module/node_modules/g/package.json
new file mode 100644
index 0000000..3a16bd4
--- /dev/null
+++ b/test/files/tr_module/node_modules/g/package.json
@@ -0,0 +1,6 @@
+{
+  "main": "index.js",
+  "browserify": {
+    "transform": "insert-ggg"
+  }
+}
diff --git a/test/files/tr_module/node_modules/insert-aaa/index.js b/test/files/tr_module/node_modules/insert-aaa/index.js
new file mode 100644
index 0000000..48fbf71
--- /dev/null
+++ b/test/files/tr_module/node_modules/insert-aaa/index.js
@@ -0,0 +1,7 @@
+var through = require('through');
+
+module.exports = function (file) {
+    return through(function (buf) {
+        this.queue(String(buf).replace(/AAA/g, '5');
+    });
+};
diff --git a/test/files/tr_module/node_modules/insert-bbb/index.js b/test/files/tr_module/node_modules/insert-bbb/index.js
new file mode 100644
index 0000000..43df177
--- /dev/null
+++ b/test/files/tr_module/node_modules/insert-bbb/index.js
@@ -0,0 +1,7 @@
+var through = require('through');
+
+module.exports = function (file) {
+    return through(function (buf) {
+        this.queue(String(buf).replace(/BBB/g, '50');
+    });
+};
diff --git a/test/files/tr_module/node_modules/m/index.js b/test/files/tr_module/node_modules/m/index.js
new file mode 100644
index 0000000..4cd0ff3
--- /dev/null
+++ b/test/files/tr_module/node_modules/m/index.js
@@ -0,0 +1,3 @@
+var AAA = 200, BBB = 300;
+
+module.exports = function (x) { return AAA + BBB + x }
diff --git a/test/tr_module.js b/test/tr_module.js
new file mode 100644
index 0000000..f4ca9c6
--- /dev/null
+++ b/test/tr_module.js
@@ -0,0 +1,20 @@
+var mdeps = require('../');
+var test = require('tap').test;
+var JSONStream = require('JSONStream');
+var packer = require('browser-pack');
+
+test('transform', function (t) {
+    t.plan(3);
+    var p = mdeps(__dirname + '/files/tr/main.js', {
+        transform: [ 'insert-aaa', 'insert-bbb' ]
+    });
+    var pack = packer();
+    
+    p.pipe(JSONStream.stringify()).pipe(pack);
+    
+    var src = '';
+    pack.on('data', function (buf) { src += buf });
+    pack.on('end', function () {
+        Function('t', src)(t);
+    });
+});

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