Skip to content

Commit 9b6963d

Browse files
author
James Halliday
committed
passing test
1 parent 26982ed commit 9b6963d

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

test/bundle.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
var test = require('tape');
2+
var splicer = require('../');
3+
var through = require('through2');
4+
var deps = require('module-deps');
5+
var pack = require('browser-pack');
6+
var concat = require('concat-stream');
7+
8+
test('bundle', function (t) {
9+
t.plan(1);
10+
11+
var pipeline = splicer.obj([
12+
'deps', [ deps(__dirname + '/bundle/main.js') ],
13+
'pack', [ pack({ raw: true }) ]
14+
]);
15+
pipeline.pipe(concat(function (body) {
16+
Function([ 'console' ], body.toString('utf8'))({ log: log });
17+
function log (msg) {
18+
t.equal(msg, 'main: 56055');
19+
}
20+
}));
21+
22+
pipeline.get('deps').push(through.obj(function (row, enc, next) {
23+
row.source = row.source.replace(/111/g, '11111');
24+
this.push(row);
25+
next();
26+
}));
27+
});

test/bundle/bar.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = function (n) {
2+
return n * 100;
3+
};

test/bundle/foo.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var bar = require('./bar');
2+
3+
module.exports = function (n) {
4+
return n * 111 + bar(n);
5+
};

test/bundle/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var foo = require('./foo');
2+
console.log('main: ' + foo(5));

test/bundle/xyz.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var foo = require('./foo');
2+
console.log('xyz: ' + foo(6));

0 commit comments

Comments
 (0)