File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ var through = require ( 'through2' ) ;
2
+ var mdeps = require ( '../' ) ;
3
+ var test = require ( 'tap' ) . test ;
4
+
5
+ test ( '--debug passed to transforms' , function ( t ) {
6
+ var empty = require . resolve ( './tr_flags/empty.js' ) ;
7
+
8
+ t . plan ( 5 ) ;
9
+
10
+ var p
11
+ [ true , false ] . forEach ( function ( debug ) {
12
+ p = mdeps ( {
13
+ debug : debug ,
14
+ transform : function ( file , opts ) {
15
+ t . equal ( opts . _flags . debug , debug , 'debug: ' + debug ) ;
16
+ return through ( ) ;
17
+ }
18
+ } )
19
+ p . on ( 'error' , function ( err ) { return t . fail ( err . message ) } )
20
+ p . end ( empty ) ;
21
+
22
+ p = mdeps ( { debug : debug } )
23
+ p . write ( {
24
+ transform : function ( file , opts ) {
25
+ t . equal ( opts . _flags . debug , debug , 'debug: ' + debug ) ;
26
+ return through ( ) ;
27
+ } ,
28
+ options : { }
29
+ } )
30
+ p . on ( 'error' , function ( err ) { return t . fail ( err . message ) } )
31
+ p . end ( empty ) ;
32
+ } ) ;
33
+
34
+ p = mdeps ( { debug : true } )
35
+ p . write ( {
36
+ transform : function ( file , opts ) {
37
+ t . equal ( opts . _flags , Infinity , 'transform arguents are preserved' ) ;
38
+ return through ( ) ;
39
+ } ,
40
+ options : { _flags : Infinity }
41
+ } )
42
+ p . on ( 'error' , function ( err ) { return t . fail ( err . message ) } )
43
+ p . end ( empty ) ;
44
+ } ) ;
You can’t perform that action at this time.
0 commit comments