@@ -62,22 +62,24 @@ describe('gzip plugin', function() {
6262 return previous ;
6363 } , [ ] ) ;
6464
65- assert . equal ( messages . length , 5 ) ;
65+ assert . equal ( messages . length , 6 ) ;
6666 } ) ;
6767
6868 it ( 'adds default config to the config object' , function ( ) {
6969 plugin . configure ( context ) ;
7070 assert . isDefined ( config . gzip . filePattern ) ;
71+ assert . isDefined ( config . gzip . ignorePattern ) ;
7172 assert . isDefined ( config . gzip . distDir ) ;
7273 assert . isDefined ( config . gzip . distFiles ) ;
7374 assert . isDefined ( config . gzip . zopfli ) ;
7475 } ) ;
7576 } ) ;
76- describe ( 'with a filePattern, zopfli, distDir, and distFiles provided' , function ( ) {
77+ describe ( 'with a filePattern, ignorePattern, zopfli, distDir, and distFiles provided' , function ( ) {
7778 beforeEach ( function ( ) {
7879 config = {
7980 gzip : {
8081 filePattern : '**/*.*' ,
82+ ignorePattern : '**/specific.thing' ,
8183 zopfli : false ,
8284 keep : false ,
8385 distDir : 'tmp/dist-deploy' ,
@@ -121,12 +123,14 @@ describe('gzip plugin', function() {
121123 distFiles : [
122124 'assets/foo.js' ,
123125 'assets/bar.notjs' ,
126+ 'assets/ignore.js' ,
124127 ] ,
125128 ui : mockUi ,
126129 project : { name : function ( ) { return 'test-project' ; } } ,
127130 config : {
128131 gzip : {
129132 filePattern : '**/*.js' ,
133+ ignorePattern : '**/ignore.*' ,
130134 distDir : function ( context ) { return context . distDir ; } ,
131135 distFiles : function ( context ) { return context . distFiles ; }
132136 }
@@ -137,6 +141,7 @@ describe('gzip plugin', function() {
137141 if ( ! fs . existsSync ( path . join ( context . distDir , 'assets' ) ) ) { fs . mkdirSync ( path . join ( context . distDir , 'assets' ) ) ; }
138142 fs . writeFileSync ( path . join ( context . distDir , context . distFiles [ 0 ] ) , 'alert("Hello foo world!");' , 'utf8' ) ;
139143 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' ) ;
140145 plugin . beforeHook ( context ) ;
141146 plugin . gzipLibrary = require ( 'zlib' ) ;
142147 } ) ;
@@ -145,7 +150,7 @@ describe('gzip plugin', function() {
145150 return rimraf ( context . distDir ) ;
146151 } ) ;
147152
148- it ( 'gzips the matching files' , function ( done ) {
153+ it ( 'gzips the matching files which are not ignored ' , function ( done ) {
149154 return assert . isFulfilled ( plugin . willUpload ( context ) )
150155 . then ( function ( result ) {
151156 assert . deepEqual ( result , { gzippedFiles : [ 'assets/foo.js' ] } ) ;
0 commit comments