[Pkg-javascript-commits] [node-module-deps] 324/444: transform pipeline test
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:48:09 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 bdcc68a1afdae4a0eb63c056e2b2d2ca648f618f
Author: James Halliday <mail at substack.net>
Date: Thu Dec 4 01:37:40 2014 -0800
transform pipeline test
---
test/node_modules/insert-www/index.js | 8 ++++++++
test/tr_write.js | 32 ++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/test/node_modules/insert-www/index.js b/test/node_modules/insert-www/index.js
new file mode 100644
index 0000000..db9d97d
--- /dev/null
+++ b/test/node_modules/insert-www/index.js
@@ -0,0 +1,8 @@
+var through = require('through2');
+
+module.exports = function (file) {
+ return through(function (buf, enc, next) {
+ this.push(String(buf).replace(/WWW/g, '"world wide wow"'));
+ next();
+ });
+};
diff --git a/test/tr_write.js b/test/tr_write.js
new file mode 100644
index 0000000..c33ccb5
--- /dev/null
+++ b/test/tr_write.js
@@ -0,0 +1,32 @@
+var mdeps = require('../');
+var test = require('tape');
+var JSONStream = require('JSONStream');
+var packer = require('browser-pack');
+var path = require('path');
+var concat = require('concat-stream');
+
+test('transform write', function (t) {
+ t.plan(1);
+ var p = mdeps();
+
+ p.write({
+ transform: 'insert-www',
+ options: {}
+ });
+ p.write({
+ file: path.join(__dirname, 'tr_write/main.js'),
+ id: path.join(__dirname, 'tr_write/main.js'),
+ entry: true
+ });
+ p.end();
+
+ var pack = packer();
+ p.pipe(JSONStream.stringify()).pipe(pack);
+
+ pack.pipe(concat(function (buf) {
+ var src = buf.toString('utf');
+ Function('console', src)({ log: function (msg) {
+ t.equal(msg, 'WORLD WIDE WOW');
+ } });
+ }));
+});
--
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