File tree Expand file tree Collapse file tree 5 files changed +39
-0
lines changed Expand file tree Collapse file tree 5 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
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 ( / 1 1 1 / g, '11111' ) ;
24
+ this . push ( row ) ;
25
+ next ( ) ;
26
+ } ) ) ;
27
+ } ) ;
Original file line number Diff line number Diff line change
1
+ module . exports = function ( n ) {
2
+ return n * 100 ;
3
+ } ;
Original file line number Diff line number Diff line change
1
+ var bar = require ( './bar' ) ;
2
+
3
+ module . exports = function ( n ) {
4
+ return n * 111 + bar ( n ) ;
5
+ } ;
Original file line number Diff line number Diff line change
1
+ var foo = require ( './foo' ) ;
2
+ console . log ( 'main: ' + foo ( 5 ) ) ;
Original file line number Diff line number Diff line change
1
+ var foo = require ( './foo' ) ;
2
+ console . log ( 'xyz: ' + foo ( 6 ) ) ;
You can’t perform that action at this time.
0 commit comments