You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a test I wrote that fails when using a memfs volume but passes when using the real 'fs':
constfs=require('fs');constpath=require('path');constassert=require('assert');const{ Volume }=require('memfs');describe('memfs ctime',async()=>{it('should change ctime',async()=>{constvol=newVolume();const_fs_=vol;// test fails// const _fs_ = fs; // test passesconstfile='/tmp/test-memfs-ctime.txt';// Wait 1ms between actions to be sure the times change.constsleep=()=>newPromise(resolve=>setTimeout(resolve,1));// Create the file if it doesn't exist._fs_.mkdirSync(path.dirname(file),{recursive: true});_fs_.closeSync(_fs_.openSync(file,'a'));// Get the ctime before any changes.letinitial=_fs_.statSync(file).ctimeMs;// Get the ctime after writing to the file.awaitsleep();_fs_.writeFileSync(file,'testing memfs ctime','utf8');letafterWrite=_fs_.statSync(file).ctimeMs;// Get the ctime after changing the file's atime and mtime.awaitsleep();letoneSecondAgo=newDate(Date.now()-1000);_fs_.utimesSync(file,oneSecondAgo,oneSecondAgo);letafterMtimeChange=_fs_.statSync(file).ctimeMs;assert(afterWrite>initial,'ctime should be greater after write than before');assert(afterMtimeChange>afterWrite,'ctime should be greater after utimes change than before');});});
The text was updated successfully, but these errors were encountered:
mtime and atime both seem to behave as expected, but ctime does not.
Seems like it could be related to #891 and #889
Here's a test I wrote that fails when using a memfs volume but passes when using the real 'fs':
The text was updated successfully, but these errors were encountered: