File tree Expand file tree Collapse file tree
packages/fs-node/src/__tests__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1637,9 +1637,25 @@ describe('volume', () => {
16371637 } ) ;
16381638
16391639 it ( 'suppresses only ENOENT; other errors still throw' , ( ) => {
1640- const vol = Volume . fromJSON ( { '/file.txt' : 'x' } ) ;
1640+ const vol = Volume . fromJSON ( { '/dir/file.txt' : 'x' } ) ;
1641+ vol . chmodSync ( '/dir' , 0 ) ;
1642+ expect ( ( ) => vol . watch ( '/dir/file.txt' , { throwIfNoEntry : false } ) ) . toThrow ( / E A C C E S / ) ;
1643+ } ) ;
1644+
1645+ it ( 'throws ENOTDIR for traversal through a file on POSIX' , ( ) => {
1646+ const vol = Volume . fromJSON ( { '/file.txt' : 'x' } , undefined , {
1647+ process : { ...process , platform : 'linux' } ,
1648+ } ) ;
16411649 expect ( ( ) => vol . watch ( '/file.txt/sub' , { throwIfNoEntry : false } ) ) . toThrow ( / E N O T D I R / ) ;
16421650 } ) ;
1651+
1652+ it ( 'suppresses the ENOENT reported for traversal through a file on Windows' , ( ) => {
1653+ const vol = Volume . fromJSON ( { '/file.txt' : 'x' } , undefined , {
1654+ process : { ...process , platform : 'win32' } ,
1655+ } ) ;
1656+ const watcher = vol . watch ( '/file.txt/sub' , { throwIfNoEntry : false } ) ;
1657+ watcher . close ( ) ;
1658+ } ) ;
16431659 } ) ;
16441660
16451661 describe ( 'ignore option' , ( ) => {
You can’t perform that action at this time.
0 commit comments