[Pkg-javascript-commits] [node-module-deps] 310/444: passing test for transform with no entries

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:48:08 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 c689c090e08273fb85c3aa3d0a88d88946e915d4
Author: James Halliday <mail at substack.net>
Date:   Wed Nov 19 02:45:39 2014 +0100

    passing test for transform with no entries
---
 test/files/tr_no_entry/main.js |  1 +
 test/tr_no_entry.js            | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/test/files/tr_no_entry/main.js b/test/files/tr_no_entry/main.js
new file mode 100644
index 0000000..4f1d733
--- /dev/null
+++ b/test/files/tr_no_entry/main.js
@@ -0,0 +1 @@
+console.log(AAA)
diff --git a/test/tr_no_entry.js b/test/tr_no_entry.js
new file mode 100644
index 0000000..7fe48c9
--- /dev/null
+++ b/test/tr_no_entry.js
@@ -0,0 +1,30 @@
+var mdeps = require('../');
+var test = require('tape');
+var JSONStream = require('JSONStream');
+var packer = require('browser-pack');
+var through = require('through');
+var concat = require('concat-stream');
+var path = require('path');
+
+test('transform no entry', function (t) {
+    t.plan(1);
+    var p = mdeps({
+        transform: [ function (file) {
+            return through(function (buf) {
+                this.queue(String(buf).replace(/AAA/g, '"WOW"'));
+            });
+        } ]
+    });
+    p.end({
+        file: path.join(__dirname, '/files/tr_no_entry/main.js'),
+        id: 'xxx'
+    });
+    
+    p.pipe(JSONStream.stringify()).pipe(packer())
+        .pipe(concat(function (body) {
+            var con = { log: function (x) { t.equal(x, 'WOW') } };
+            var src = 'require=' + body.toString('utf8') + ';require("xxx")';
+            Function('console', src)(con);
+        }))
+    ;
+});

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