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
The readdir method fails on an empty directory, if it is not present on the first filesystem.
Failing test case:
import{Volume}from'memfs';it('does not throw when directory is empty and first fs fails',()=>{constvol=Volume.fromJSON({});constvol2=Volume.fromJSON({'/foo': null,});constufs=newUnion();ufs.use(volasany);ufs.use(vol2asany);expect(()=>ufs.readdirSync('/foo')).not.toThrow();});
However, the test passes if the fs order is swapped:
it('does not throw when directory is empty and second fs fails',()=>{constvol=Volume.fromJSON({'/foo': null,});constvol2=Volume.fromJSON({});constufs=newUnion();ufs.use(volasany);ufs.use(vol2asany);expect(()=>ufs.readdirSync('/foo')).not.toThrow();});
It also passes if the directory is not empty:
it('does not throw when directory is not empty and first fs fails',()=>{constvol=Volume.fromJSON({});constvol2=Volume.fromJSON({'/foo/child': null,});constufs=newUnion();ufs.use(volasany);ufs.use(vol2asany);expect(()=>ufs.readdirSync('/foo')).not.toThrow();});
The text was updated successfully, but these errors were encountered:
The
readdir
method fails on an empty directory, if it is not present on the first filesystem.Failing test case:
However, the test passes if the fs order is swapped:
It also passes if the directory is not empty:
The text was updated successfully, but these errors were encountered: