forked from browserify/module-deps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtr_write.js
32 lines (28 loc) · 814 Bytes
/
tr_write.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var mdeps = require('../');
var test = require('tap').test;
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('utf8');
Function('console', src)({ log: function (msg) {
t.equal(msg, 'WORLD WIDE WOW');
} });
}));
});