@@ -21,39 +21,34 @@ const filepathOne = path.join(testsubdir, filenameOne);
21
21
if ( ! common . isOSX && ! common . isWindows ) {
22
22
common . expectsError ( ( ) => fs . watch ( testDir , { recursive : true } ) ,
23
23
{ code : 'ERR_FEATURE_UNAVAILABLE_ON_PLATFORM' } ) ;
24
- } else {
25
-
26
- testWhenRecursiveIsImplemented ( ) ;
24
+ return ;
27
25
}
26
+ const watcher = fs . watch ( testDir , { recursive : true } ) ;
28
27
29
- function testWhenRecursiveIsImplemented ( ) {
30
- const watcher = fs . watch ( testDir , { recursive : true } ) ;
31
-
32
- let watcherClosed = false ;
33
- watcher . on ( 'change' , function ( event , filename ) {
34
- assert . ok ( event === 'change' || event === 'rename' ) ;
35
-
36
- // Ignore stale events generated by mkdir and other tests
37
- if ( filename !== relativePathOne )
38
- return ;
28
+ let watcherClosed = false ;
29
+ watcher . on ( 'change' , function ( event , filename ) {
30
+ assert . ok ( event === 'change' || event === 'rename' ) ;
39
31
40
- if ( common . isOSX ) {
41
- clearInterval ( interval ) ;
42
- }
43
- watcher . close ( ) ;
44
- watcherClosed = true ;
45
- } ) ;
32
+ // Ignore stale events generated by mkdir and other tests
33
+ if ( filename !== relativePathOne )
34
+ return ;
46
35
47
- let interval ;
48
36
if ( common . isOSX ) {
49
- interval = setInterval ( function ( ) {
50
- fs . writeFileSync ( filepathOne , 'world' ) ;
51
- } , 10 ) ;
52
- } else {
53
- fs . writeFileSync ( filepathOne , 'world' ) ;
37
+ clearInterval ( interval ) ;
54
38
}
39
+ watcher . close ( ) ;
40
+ watcherClosed = true ;
41
+ } ) ;
55
42
56
- process . on ( 'exit' , function ( ) {
57
- assert ( watcherClosed , 'watcher Object was not closed' ) ;
58
- } ) ;
43
+ let interval ;
44
+ if ( common . isOSX ) {
45
+ interval = setInterval ( function ( ) {
46
+ fs . writeFileSync ( filepathOne , 'world' ) ;
47
+ } , 10 ) ;
48
+ } else {
49
+ fs . writeFileSync ( filepathOne , 'world' ) ;
59
50
}
51
+
52
+ process . on ( 'exit' , function ( ) {
53
+ assert ( watcherClosed , 'watcher Object was not closed' ) ;
54
+ } ) ;
0 commit comments