[Pkg-javascript-commits] [node-module-deps] 89/444: Failing test case demonstrating that transforms from two dependencies are not applied correctly.
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:47:45 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 682d9ce3b404758a71050ff56dd0d99914ed0a66
Author: Jared Hanson <jaredhanson at gmail.com>
Date: Fri Jun 7 18:18:05 2013 -0700
Failing test case demonstrating that transforms from two dependencies are not applied correctly.
---
test/files/tr_2dep_module/f.js | 1 +
test/files/tr_2dep_module/main.js | 7 +++++++
test/files/tr_2dep_module/node_modules/g/index.js | 1 +
.../g/node_modules/insert-ggg/index.js | 7 +++++++
.../tr_2dep_module/node_modules/g/package.json | 6 ++++++
.../node_modules/insert-aaa/index.js | 7 +++++++
.../node_modules/insert-bbb/index.js | 7 +++++++
test/files/tr_2dep_module/node_modules/m/index.js | 3 +++
.../m/node_modules/insert-mmm/index.js | 7 +++++++
.../tr_2dep_module/node_modules/m/package.json | 6 ++++++
test/tr_2dep_module.js | 23 ++++++++++++++++++++++
11 files changed, 75 insertions(+)
diff --git a/test/files/tr_2dep_module/f.js b/test/files/tr_2dep_module/f.js
new file mode 100644
index 0000000..39c9ea4
--- /dev/null
+++ b/test/files/tr_2dep_module/f.js
@@ -0,0 +1 @@
+module.exports = function (x) { return x + BBB }
diff --git a/test/files/tr_2dep_module/main.js b/test/files/tr_2dep_module/main.js
new file mode 100644
index 0000000..084b20e
--- /dev/null
+++ b/test/files/tr_2dep_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_2dep_module/node_modules/g/index.js b/test/files/tr_2dep_module/node_modules/g/index.js
new file mode 100644
index 0000000..ee3356a
--- /dev/null
+++ b/test/files/tr_2dep_module/node_modules/g/index.js
@@ -0,0 +1 @@
+module.exports = function (x) { return x * GGG }
diff --git a/test/files/tr_2dep_module/node_modules/g/node_modules/insert-ggg/index.js b/test/files/tr_2dep_module/node_modules/g/node_modules/insert-ggg/index.js
new file mode 100644
index 0000000..d0e4862
--- /dev/null
+++ b/test/files/tr_2dep_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_2dep_module/node_modules/g/package.json b/test/files/tr_2dep_module/node_modules/g/package.json
new file mode 100644
index 0000000..3a16bd4
--- /dev/null
+++ b/test/files/tr_2dep_module/node_modules/g/package.json
@@ -0,0 +1,6 @@
+{
+ "main": "index.js",
+ "browserify": {
+ "transform": "insert-ggg"
+ }
+}
diff --git a/test/files/tr_2dep_module/node_modules/insert-aaa/index.js b/test/files/tr_2dep_module/node_modules/insert-aaa/index.js
new file mode 100644
index 0000000..0394d4e
--- /dev/null
+++ b/test/files/tr_2dep_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_2dep_module/node_modules/insert-bbb/index.js b/test/files/tr_2dep_module/node_modules/insert-bbb/index.js
new file mode 100644
index 0000000..d48906a
--- /dev/null
+++ b/test/files/tr_2dep_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_2dep_module/node_modules/m/index.js b/test/files/tr_2dep_module/node_modules/m/index.js
new file mode 100644
index 0000000..ed1f339
--- /dev/null
+++ b/test/files/tr_2dep_module/node_modules/m/index.js
@@ -0,0 +1,3 @@
+var AAA = 200, BBB = 300;
+
+module.exports = function (x) { return AAA + BBB + MMM + x }
diff --git a/test/files/tr_2dep_module/node_modules/m/node_modules/insert-mmm/index.js b/test/files/tr_2dep_module/node_modules/m/node_modules/insert-mmm/index.js
new file mode 100644
index 0000000..e9213ef
--- /dev/null
+++ b/test/files/tr_2dep_module/node_modules/m/node_modules/insert-mmm/index.js
@@ -0,0 +1,7 @@
+var through = require('through');
+
+module.exports = function (file) {
+ return through(function (buf) {
+ this.queue(String(buf).replace(/MMM/g, '222'));
+ });
+};
diff --git a/test/files/tr_2dep_module/node_modules/m/package.json b/test/files/tr_2dep_module/node_modules/m/package.json
new file mode 100644
index 0000000..0cb75aa
--- /dev/null
+++ b/test/files/tr_2dep_module/node_modules/m/package.json
@@ -0,0 +1,6 @@
+{
+ "main": "index.js",
+ "browserify": {
+ "transform": "insert-mmm"
+ }
+}
diff --git a/test/tr_2dep_module.js b/test/tr_2dep_module.js
new file mode 100644
index 0000000..8e6d63e
--- /dev/null
+++ b/test/tr_2dep_module.js
@@ -0,0 +1,23 @@
+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_2dep_module/main.js', {
+ transform: [ 'insert-aaa', 'insert-bbb' ],
+ 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 () {
+ console.error('SOURCE:');
+ console.error(src);
+ 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