@@ -1818,24 +1818,26 @@ const runTests = function(baseopts) {
18181818 if ( ! macosFswatch ) spy . should . have . been . calledOnce ;
18191819 } ) ;
18201820 it ( 'should ignore unwatched paths that are a subset of watched paths' , async ( ) => {
1821+ const subdirRel = upath . relative ( process . cwd ( ) , getFixturePath ( 'subdir' ) ) ;
1822+ const unlinkFile = getFixturePath ( 'unlink.txt' ) ;
1823+ const addFile = getFixturePath ( 'subdir/add.txt' ) ;
1824+ const changedFile = getFixturePath ( 'change.txt' ) ;
18211825 let watcher = chokidar_watch ( currentDir , options ) ;
18221826 const spy = await aspy ( watcher , 'all' ) ;
18231827
1824- await delay ( ) ;
18251828 // test with both relative and absolute paths
1826- const subdirRel = upath . relative ( process . cwd ( ) , getFixturePath ( 'subdir' ) ) ;
18271829 watcher . unwatch ( [ subdirRel , getGlobPath ( 'unl*' ) ] ) ;
18281830
18291831 await delay ( ) ;
1830- await fs_unlink ( getFixturePath ( 'unlink.txt' ) ) ;
1831- await write ( getFixturePath ( 'subdir/add.txt' ) , Date . now ( ) ) ;
1832- await write ( getFixturePath ( 'change.txt' ) , Date . now ( ) ) ;
1832+ await fs_unlink ( unlinkFile ) ;
1833+ await write ( addFile , Date . now ( ) ) ;
1834+ await write ( changedFile , Date . now ( ) ) ;
18331835 await waitFor ( [ spy . withArgs ( 'change' ) ] ) ;
18341836
18351837 await delay ( 300 ) ;
1836- spy . should . have . been . calledWith ( 'change' , getFixturePath ( 'change.txt' ) ) ;
1837- spy . should . not . have . been . calledWith ( 'add' , getFixturePath ( 'subdir/add.txt' ) ) ;
1838- spy . should . not . have . been . calledWith ( 'unlink' ) ;
1838+ spy . should . have . been . calledWith ( 'change' , changedFile ) ;
1839+ spy . should . not . have . been . calledWith ( 'add' , addFile ) ;
1840+ spy . should . not . have . been . calledWith ( 'unlink' , unlinkFile ) ;
18391841 if ( ! macosFswatch ) spy . should . have . been . calledOnce ;
18401842 } ) ;
18411843 it ( 'should unwatch relative paths' , async ( ) => {
0 commit comments