@@ -141,7 +141,7 @@ describe('gzip plugin', function() {
141141 if ( ! fs . existsSync ( context . distDir ) ) { fs . mkdirSync ( context . distDir ) ; }
142142 if ( ! fs . existsSync ( path . join ( context . distDir , 'assets' ) ) ) { fs . mkdirSync ( path . join ( context . distDir , 'assets' ) ) ; }
143143 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" ) ) ;
145145 fs . writeFileSync ( path . join ( context . distDir , context . distFiles [ 1 ] ) , 'alert("Hello bar world!");' , 'utf8' ) ;
146146 fs . writeFileSync ( path . join ( context . distDir , context . distFiles [ 2 ] ) , 'alert("Hello ignore world!");' , 'utf8' ) ;
147147 plugin . beforeHook ( context ) ;
@@ -187,7 +187,7 @@ describe('gzip plugin', function() {
187187 } ) ;
188188 } ) ;
189189
190- it ( 'has the same timestamp as the original' , function ( done ) {
190+ it ( 'has the same mtime timestamp as the original' , function ( done ) {
191191 assert . isFulfilled ( plugin . willUpload ( context ) )
192192 . then ( function ( result ) {
193193 var mtime_gz = fs . statSync ( path . join ( context . distDir , result . gzippedFiles [ 0 ] ) ) . mtime . valueOf ( ) ;
@@ -201,6 +201,20 @@ describe('gzip plugin', function() {
201201 } ) ;
202202 } ) ;
203203
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+
204218 it ( 'does not use the same object for gzippedFiles and distFiles' , function ( done ) {
205219 assert . isFulfilled ( plugin . willUpload ( context ) )
206220 . then ( function ( result ) {
0 commit comments