@@ -62,22 +62,24 @@ describe('gzip plugin', function() {
62
62
return previous ;
63
63
} , [ ] ) ;
64
64
65
- assert . equal ( messages . length , 5 ) ;
65
+ assert . equal ( messages . length , 6 ) ;
66
66
} ) ;
67
67
68
68
it ( 'adds default config to the config object' , function ( ) {
69
69
plugin . configure ( context ) ;
70
70
assert . isDefined ( config . gzip . filePattern ) ;
71
+ assert . isDefined ( config . gzip . ignorePattern ) ;
71
72
assert . isDefined ( config . gzip . distDir ) ;
72
73
assert . isDefined ( config . gzip . distFiles ) ;
73
74
assert . isDefined ( config . gzip . zopfli ) ;
74
75
} ) ;
75
76
} ) ;
76
- describe ( 'with a filePattern, zopfli, distDir, and distFiles provided' , function ( ) {
77
+ describe ( 'with a filePattern, ignorePattern, zopfli, distDir, and distFiles provided' , function ( ) {
77
78
beforeEach ( function ( ) {
78
79
config = {
79
80
gzip : {
80
81
filePattern : '**/*.*' ,
82
+ ignorePattern : '**/specific.thing' ,
81
83
zopfli : false ,
82
84
keep : false ,
83
85
distDir : 'tmp/dist-deploy' ,
@@ -121,12 +123,14 @@ describe('gzip plugin', function() {
121
123
distFiles : [
122
124
'assets/foo.js' ,
123
125
'assets/bar.notjs' ,
126
+ 'assets/ignore.js' ,
124
127
] ,
125
128
ui : mockUi ,
126
129
project : { name : function ( ) { return 'test-project' ; } } ,
127
130
config : {
128
131
gzip : {
129
132
filePattern : '**/*.js' ,
133
+ ignorePattern : '**/ignore.*' ,
130
134
distDir : function ( context ) { return context . distDir ; } ,
131
135
distFiles : function ( context ) { return context . distFiles ; }
132
136
}
@@ -137,6 +141,7 @@ describe('gzip plugin', function() {
137
141
if ( ! fs . existsSync ( path . join ( context . distDir , 'assets' ) ) ) { fs . mkdirSync ( path . join ( context . distDir , 'assets' ) ) ; }
138
142
fs . writeFileSync ( path . join ( context . distDir , context . distFiles [ 0 ] ) , 'alert("Hello foo world!");' , 'utf8' ) ;
139
143
fs . writeFileSync ( path . join ( context . distDir , context . distFiles [ 1 ] ) , 'alert("Hello bar world!");' , 'utf8' ) ;
144
+ fs . writeFileSync ( path . join ( context . distDir , context . distFiles [ 2 ] ) , 'alert("Hello ignore world!");' , 'utf8' ) ;
140
145
plugin . beforeHook ( context ) ;
141
146
plugin . gzipLibrary = require ( 'zlib' ) ;
142
147
} ) ;
@@ -145,7 +150,7 @@ describe('gzip plugin', function() {
145
150
return rimraf ( context . distDir ) ;
146
151
} ) ;
147
152
148
- it ( 'gzips the matching files' , function ( done ) {
153
+ it ( 'gzips the matching files which are not ignored ' , function ( done ) {
149
154
return assert . isFulfilled ( plugin . willUpload ( context ) )
150
155
. then ( function ( result ) {
151
156
assert . deepEqual ( result , { gzippedFiles : [ 'assets/foo.js' ] } ) ;
0 commit comments