@@ -125,15 +125,17 @@ t.test('pack a file with a prefix', t => {
125125 } )
126126} )
127127
128- t . test ( 'pack a dir' , t => {
128+ t . test ( 'portable pack a dir' , t => {
129129 const out = [ ]
130130
131- new Pack ( { cwd : files , portable : true } )
131+ new Pack ( { cwd : files , portable : true , gzip : true } )
132132 . add ( 'dir' )
133133 . on ( 'data' , c => out . push ( c ) )
134134 . end ( )
135135 . on ( 'end' , _ => {
136- const data = Buffer . concat ( out )
136+ const zipped = Buffer . concat ( out )
137+ t . equal ( zipped [ 9 ] , 255 , 'gzip OS flag set to "unknown"' )
138+ const data = new miniz . Gunzip ( ) . end ( zipped ) . read ( )
137139 // dir/, dir/x, and the nulls
138140 // neither the dir or the file have any body bits
139141 const h = new Header ( data )
@@ -159,8 +161,12 @@ t.test('pack a dir', t => {
159161 t . equal ( data . length , 2048 )
160162 t . match ( data . slice ( 1024 ) . toString ( ) , / ^ \0 { 1024 } $ / )
161163
162- const sync = new PackSync ( { cwd : files , portable : true } )
164+ const syncgz = new PackSync ( { cwd : files , portable : true , gzip : true } )
163165 . add ( 'dir' ) . end ( ) . read ( )
166+
167+ t . equal ( syncgz [ 9 ] , 255 , 'gzip OS flag set to "unknown"' )
168+ const sync = new miniz . Gunzip ( ) . end ( zipped ) . read ( )
169+
164170 t . equal ( sync . slice ( 512 ) . toString ( ) , data . slice ( 512 ) . toString ( ) )
165171 const hs = new Header ( sync )
166172 t . match ( hs , expect )
0 commit comments