@@ -10,7 +10,7 @@ var fixturesDir = path.join(__dirname, 'fixtures/config');
10
10
var expectedDir = path . join ( __dirname , 'expected' ) ;
11
11
var runner = require ( 'gulp-test-tools' ) . gulpRunner ( ) . basedir ( fixturesDir ) ;
12
12
13
- describe ( 'config: flags.compactTasks' , function ( ) {
13
+ describe ( 'config: flags.compactTasks' , function ( ) {
14
14
15
15
it ( 'Should compact task lists when `flags.compactTasks` is true in .gulp.*' ,
16
16
function ( done ) {
@@ -52,4 +52,41 @@ describe ('config: flags.compactTasks', function() {
52
52
}
53
53
} ) ;
54
54
55
+ it ( 'Should overridden by cli flag: --compact-tasks' , function ( done ) {
56
+ runner
57
+ . chdir ( 'flags/compactTasks/f' )
58
+ . gulp ( '--tasks --compact-tasks' )
59
+ . run ( cb ) ;
60
+
61
+ function cb ( err , stdout , stderr ) {
62
+ var filepath = path . join ( expectedDir , 'flags-tasks-compact.txt' ) ;
63
+ var expected = fs . readFileSync ( filepath , 'utf-8' ) ;
64
+ expected = skipLines ( expected , 1 ) ;
65
+
66
+ stdout = eraseTime ( skipLines ( stdout , 1 ) ) ;
67
+
68
+ expect ( stdout ) . toEqual ( expected ) ;
69
+ expect ( stderr ) . toEqual ( '' ) ;
70
+ done ( err ) ;
71
+ }
72
+ } ) ;
73
+
74
+ it ( 'Should overridden by cli flag: --no-compact-tasks' , function ( done ) {
75
+ runner
76
+ . chdir ( 'flags/compactTasks/t' )
77
+ . gulp ( '--tasks --no-compact-tasks' )
78
+ . run ( cb ) ;
79
+
80
+ function cb ( err , stdout , stderr ) {
81
+ var filepath = path . join ( expectedDir , 'flags-tasks-unsorted.txt' ) ;
82
+ var expected = fs . readFileSync ( filepath , 'utf-8' ) ;
83
+ expected = skipLines ( expected , 1 ) ;
84
+
85
+ stdout = eraseTime ( skipLines ( stdout , 1 ) ) ;
86
+
87
+ expect ( stdout ) . toEqual ( expected ) ;
88
+ expect ( stderr ) . toEqual ( '' ) ;
89
+ done ( err ) ;
90
+ }
91
+ } ) ;
55
92
} ) ;
0 commit comments