@@ -141,7 +141,7 @@ describe('gzip plugin', function() {
141
141
if ( ! fs . existsSync ( context . distDir ) ) { fs . mkdirSync ( context . distDir ) ; }
142
142
if ( ! fs . existsSync ( path . join ( context . distDir , 'assets' ) ) ) { fs . mkdirSync ( path . join ( context . distDir , 'assets' ) ) ; }
143
143
fs . writeFileSync ( path . join ( context . distDir , context . distFiles [ 0 ] ) , 'alert("Hello foo world!");' , 'utf8' ) ;
144
- fs . utimesSync ( path . join ( context . distDir , context . distFiles [ 0 ] ) , Date . now ( ) , new Date ( "2020-01-01T00:01:02Z" ) ) ;
144
+ fs . utimesSync ( path . join ( context . distDir , context . distFiles [ 0 ] ) , new Date ( ) , new Date ( "2020-01-01T00:01:02Z" ) ) ;
145
145
fs . writeFileSync ( path . join ( context . distDir , context . distFiles [ 1 ] ) , 'alert("Hello bar world!");' , 'utf8' ) ;
146
146
fs . writeFileSync ( path . join ( context . distDir , context . distFiles [ 2 ] ) , 'alert("Hello ignore world!");' , 'utf8' ) ;
147
147
plugin . beforeHook ( context ) ;
@@ -187,7 +187,7 @@ describe('gzip plugin', function() {
187
187
} ) ;
188
188
} ) ;
189
189
190
- it ( 'has the same timestamp as the original' , function ( done ) {
190
+ it ( 'has the same mtime timestamp as the original' , function ( done ) {
191
191
assert . isFulfilled ( plugin . willUpload ( context ) )
192
192
. then ( function ( result ) {
193
193
var mtime_gz = fs . statSync ( path . join ( context . distDir , result . gzippedFiles [ 0 ] ) ) . mtime . valueOf ( ) ;
@@ -201,6 +201,20 @@ describe('gzip plugin', function() {
201
201
} ) ;
202
202
} ) ;
203
203
204
+ it ( 'atime timestamp is slightly newer than the original' , function ( done ) {
205
+ assert . isFulfilled ( plugin . willUpload ( context ) )
206
+ . then ( function ( result ) {
207
+ var atime_gz = fs . statSync ( path . join ( context . distDir , result . gzippedFiles [ 0 ] ) ) . atime . valueOf ( ) ;
208
+ var atime_orig = fs . statSync ( path . join ( context . distDir , context . distFiles [ 0 ] ) ) . atime . valueOf ( ) ;
209
+
210
+ assert . ok ( atime_gz - atime_orig < 1000 ) ;
211
+
212
+ done ( ) ;
213
+ } ) . catch ( function ( reason ) {
214
+ done ( reason ) ;
215
+ } ) ;
216
+ } ) ;
217
+
204
218
it ( 'does not use the same object for gzippedFiles and distFiles' , function ( done ) {
205
219
assert . isFulfilled ( plugin . willUpload ( context ) )
206
220
. then ( function ( result ) {
0 commit comments