@@ -125,15 +125,17 @@ t.test('pack a file with a prefix', t => {
125
125
} )
126
126
} )
127
127
128
- t . test ( 'pack a dir' , t => {
128
+ t . test ( 'portable pack a dir' , t => {
129
129
const out = [ ]
130
130
131
- new Pack ( { cwd : files , portable : true } )
131
+ new Pack ( { cwd : files , portable : true , gzip : true } )
132
132
. add ( 'dir' )
133
133
. on ( 'data' , c => out . push ( c ) )
134
134
. end ( )
135
135
. 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 ( )
137
139
// dir/, dir/x, and the nulls
138
140
// neither the dir or the file have any body bits
139
141
const h = new Header ( data )
@@ -159,8 +161,12 @@ t.test('pack a dir', t => {
159
161
t . equal ( data . length , 2048 )
160
162
t . match ( data . slice ( 1024 ) . toString ( ) , / ^ \0 { 1024 } $ / )
161
163
162
- const sync = new PackSync ( { cwd : files , portable : true } )
164
+ const syncgz = new PackSync ( { cwd : files , portable : true , gzip : true } )
163
165
. 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
+
164
170
t . equal ( sync . slice ( 512 ) . toString ( ) , data . slice ( 512 ) . toString ( ) )
165
171
const hs = new Header ( sync )
166
172
t . match ( hs , expect )
0 commit comments