[Pkg-javascript-commits] [node-module-deps] 71/444: tests for filter
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:47:44 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 48e0725a4396ad9b2112bd681da26213e62b0000
Author: Dominic Tarr <dominic.tarr at gmail.com>
Date: Thu Apr 25 13:35:04 2013 +0100
tests for filter
---
test/files/filterable.js | 10 ++++++++++
test/filter.js | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/test/files/filterable.js b/test/files/filterable.js
new file mode 100644
index 0000000..6a21bd8
--- /dev/null
+++ b/test/files/filterable.js
@@ -0,0 +1,10 @@
+
+module.exports = {
+ events: require('events'),
+ fs : require('fs'),
+ net : require('net'),
+ http : requrie('http'),
+ https : require('https'),
+ dgram : require('dgram'),
+ dns : require('dns')
+}
diff --git a/test/filter.js b/test/filter.js
new file mode 100644
index 0000000..e35be3d
--- /dev/null
+++ b/test/filter.js
@@ -0,0 +1,37 @@
+var test = require('tap').test;
+var path = require('path')
+var mdeps = require('../')
+
+var core = ['events', 'util', 'dns', 'dgram', 'http', 'https', 'net', 'fs']
+
+var collect = []
+
+var entry = path.join(__dirname, 'files', 'filterable.js')
+
+test('can filter core deps', function (t) {
+
+ mdeps(entry, {
+ filter: function (e) {
+ return !~core.indexOf(e)
+ }
+ })
+ .on('data', function (d) {
+ collect.push(d)
+ t.equal(d.id, entry)
+ t.deepEqual(d.deps, {
+ events: false,
+ fs: false,
+ net: false,
+ https: false,
+ dgram: false,
+ dns: false
+ })
+ t.equal(d.entry, true)
+ })
+ .on('end', function () {
+ console.error(collect)
+ t.equal(collect.length, 1)
+ t.end()
+ })
+
+})
--
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