[Pkg-javascript-commits] [node-module-deps] 95/444: failing test for opts.packageFilter

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:47:46 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 e2809fb4b9f2b80732e560da5e3364d31580198e
Author: James Halliday <mail at substack.net>
Date:   Sat Jun 8 20:29:52 2013 -0700

    failing test for opts.packageFilter
---
 test/files/pkg_filter/one.js       |  1 +
 test/files/pkg_filter/package.json |  3 +++
 test/files/pkg_filter/test.js      |  1 +
 test/files/pkg_filter/two.js       |  1 +
 test/pkg_filter.js                 | 22 ++++++++++++++++++++++
 5 files changed, 28 insertions(+)

diff --git a/test/files/pkg_filter/one.js b/test/files/pkg_filter/one.js
new file mode 100644
index 0000000..e8f7328
--- /dev/null
+++ b/test/files/pkg_filter/one.js
@@ -0,0 +1 @@
+module.exports = 1
diff --git a/test/files/pkg_filter/package.json b/test/files/pkg_filter/package.json
new file mode 100644
index 0000000..0b4f872
--- /dev/null
+++ b/test/files/pkg_filter/package.json
@@ -0,0 +1,3 @@
+{
+  "main": "one.js"
+}
diff --git a/test/files/pkg_filter/test.js b/test/files/pkg_filter/test.js
new file mode 100644
index 0000000..87697b9
--- /dev/null
+++ b/test/files/pkg_filter/test.js
@@ -0,0 +1 @@
+t.equal(require('./'), 2);
diff --git a/test/files/pkg_filter/two.js b/test/files/pkg_filter/two.js
new file mode 100644
index 0000000..4afe2ed
--- /dev/null
+++ b/test/files/pkg_filter/two.js
@@ -0,0 +1 @@
+module.exports = 2
diff --git a/test/pkg_filter.js b/test/pkg_filter.js
new file mode 100644
index 0000000..135a258
--- /dev/null
+++ b/test/pkg_filter.js
@@ -0,0 +1,22 @@
+var mdeps = require('../');
+var test = require('tap').test;
+var JSONStream = require('JSONStream');
+var packer = require('browser-pack');
+var concat = require('concat-stream');
+
+test('pkg filter', function (t) {
+    t.plan(2);
+    
+    var p = mdeps(__dirname + '/files/pkg_filter/test.js', {
+        packageFilter: function (pkg) {
+            t.equal(pkg.main, 'one.js');
+            pkg.main = 'two.js'
+        }
+    });
+    var pack = packer();
+    p.pipe(JSONStream.stringify()).pipe(pack);
+    
+    pack.pipe(concat(function (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