@@ -93,14 +93,13 @@ describe('watch mode file watcher', () => {
93
93
assert . ok ( changesCount < 5 ) ;
94
94
} ) ;
95
95
96
- it ( 'should ignore files in watched directory if they are not filtered' ,
97
- { skip : ! supportsRecursiveWatching } , async ( ) => {
98
- watcher . on ( 'changed' , common . mustNotCall ( ) ) ;
99
- watcher . watchPath ( tmpdir . path ) ;
100
- writeFileSync ( tmpdir . resolve ( 'file3' ) , '1' ) ;
101
- // Wait for this long to make sure changes are not triggered
102
- await setTimeout ( 1000 ) ;
103
- } ) ;
96
+ it ( 'should ignore files in watched directory if they are not filtered' , async ( ) => {
97
+ watcher . on ( 'changed' , common . mustNotCall ( ) ) ;
98
+ watcher . watchPath ( tmpdir . path ) ;
99
+ writeFileSync ( tmpdir . resolve ( 'file3' ) , '1' ) ;
100
+ // Wait for this long to make sure changes are not triggered
101
+ await setTimeout ( 1000 ) ;
102
+ } ) ;
104
103
105
104
it ( 'should allow clearing filters' , async ( ) => {
106
105
const file = tmpdir . resolve ( 'file4' ) ;
@@ -118,58 +117,53 @@ describe('watch mode file watcher', () => {
118
117
assert . strictEqual ( changesCount , 1 ) ;
119
118
} ) ;
120
119
121
- it ( 'should watch all files in watched path when in "all" mode' ,
122
- { skip : ! supportsRecursiveWatching } , async ( ) => {
123
- watcher = new FilesWatcher ( { debounce : 100 , mode : 'all' } ) ;
124
- watcher . on ( 'changed' , ( ) => changesCount ++ ) ;
125
-
126
- const file = tmpdir . resolve ( 'file5' ) ;
127
- watcher . watchPath ( tmpdir . path ) ;
128
-
129
- const changed = once ( watcher , 'changed' ) ;
130
- await setTimeout ( common . platformTimeout ( 100 ) ) ; // avoid throttling
131
- writeFileSync ( file , 'changed' ) ;
132
- await changed ;
133
- assert . strictEqual ( changesCount , 1 ) ;
134
- } ) ;
135
-
136
- it ( 'should ruse existing watcher if it exists' ,
137
- { skip : ! supportsRecursiveWatching } , ( ) => {
138
- assert . deepStrictEqual ( watcher . watchedPaths , [ ] ) ;
139
- watcher . watchPath ( tmpdir . path ) ;
140
- assert . deepStrictEqual ( watcher . watchedPaths , [ tmpdir . path ] ) ;
141
- watcher . watchPath ( tmpdir . path ) ;
142
- assert . deepStrictEqual ( watcher . watchedPaths , [ tmpdir . path ] ) ;
143
- } ) ;
144
-
145
- it ( 'should ruse existing watcher of a parent directory' ,
146
- { skip : ! supportsRecursiveWatching } , ( ) => {
147
- assert . deepStrictEqual ( watcher . watchedPaths , [ ] ) ;
148
- watcher . watchPath ( tmpdir . path ) ;
149
- assert . deepStrictEqual ( watcher . watchedPaths , [ tmpdir . path ] ) ;
150
- watcher . watchPath ( tmpdir . resolve ( 'subdirectory' ) ) ;
151
- assert . deepStrictEqual ( watcher . watchedPaths , [ tmpdir . path ] ) ;
152
- } ) ;
153
-
154
- it ( 'should remove existing watcher if adding a parent directory watcher' ,
155
- { skip : ! supportsRecursiveWatching } , ( ) => {
156
- assert . deepStrictEqual ( watcher . watchedPaths , [ ] ) ;
157
- const subdirectory = tmpdir . resolve ( 'subdirectory' ) ;
158
- mkdirSync ( subdirectory ) ;
159
- watcher . watchPath ( subdirectory ) ;
160
- assert . deepStrictEqual ( watcher . watchedPaths , [ subdirectory ] ) ;
161
- watcher . watchPath ( tmpdir . path ) ;
162
- assert . deepStrictEqual ( watcher . watchedPaths , [ tmpdir . path ] ) ;
163
- } ) ;
164
-
165
- it ( 'should clear all watchers when calling clear' ,
166
- { skip : ! supportsRecursiveWatching } , ( ) => {
167
- assert . deepStrictEqual ( watcher . watchedPaths , [ ] ) ;
168
- watcher . watchPath ( tmpdir . path ) ;
169
- assert . deepStrictEqual ( watcher . watchedPaths , [ tmpdir . path ] ) ;
170
- watcher . clear ( ) ;
171
- assert . deepStrictEqual ( watcher . watchedPaths , [ ] ) ;
172
- } ) ;
120
+ it ( 'should watch all files in watched path when in "all" mode' , async ( ) => {
121
+ watcher = new FilesWatcher ( { debounce : 100 , mode : 'all' } ) ;
122
+ watcher . on ( 'changed' , ( ) => changesCount ++ ) ;
123
+
124
+ const file = tmpdir . resolve ( 'file5' ) ;
125
+ watcher . watchPath ( tmpdir . path ) ;
126
+
127
+ const changed = once ( watcher , 'changed' ) ;
128
+ await setTimeout ( common . platformTimeout ( 100 ) ) ; // avoid throttling
129
+ writeFileSync ( file , 'changed' ) ;
130
+ await changed ;
131
+ assert . strictEqual ( changesCount , 1 ) ;
132
+ } ) ;
133
+
134
+ it ( 'should ruse existing watcher if it exists' , ( ) => {
135
+ assert . deepStrictEqual ( watcher . watchedPaths , [ ] ) ;
136
+ watcher . watchPath ( tmpdir . path ) ;
137
+ assert . deepStrictEqual ( watcher . watchedPaths , [ tmpdir . path ] ) ;
138
+ watcher . watchPath ( tmpdir . path ) ;
139
+ assert . deepStrictEqual ( watcher . watchedPaths , [ tmpdir . path ] ) ;
140
+ } ) ;
141
+
142
+ it ( 'should ruse existing watcher of a parent directory' , ( ) => {
143
+ assert . deepStrictEqual ( watcher . watchedPaths , [ ] ) ;
144
+ watcher . watchPath ( tmpdir . path ) ;
145
+ assert . deepStrictEqual ( watcher . watchedPaths , [ tmpdir . path ] ) ;
146
+ watcher . watchPath ( tmpdir . resolve ( 'subdirectory' ) ) ;
147
+ assert . deepStrictEqual ( watcher . watchedPaths , [ tmpdir . path ] ) ;
148
+ } ) ;
149
+
150
+ it ( 'should remove existing watcher if adding a parent directory watcher' , ( ) => {
151
+ assert . deepStrictEqual ( watcher . watchedPaths , [ ] ) ;
152
+ const subdirectory = tmpdir . resolve ( 'subdirectory' ) ;
153
+ mkdirSync ( subdirectory ) ;
154
+ watcher . watchPath ( subdirectory ) ;
155
+ assert . deepStrictEqual ( watcher . watchedPaths , [ subdirectory ] ) ;
156
+ watcher . watchPath ( tmpdir . path ) ;
157
+ assert . deepStrictEqual ( watcher . watchedPaths , [ tmpdir . path ] ) ;
158
+ } ) ;
159
+
160
+ it ( 'should clear all watchers when calling clear' , ( ) => {
161
+ assert . deepStrictEqual ( watcher . watchedPaths , [ ] ) ;
162
+ watcher . watchPath ( tmpdir . path ) ;
163
+ assert . deepStrictEqual ( watcher . watchedPaths , [ tmpdir . path ] ) ;
164
+ watcher . clear ( ) ;
165
+ assert . deepStrictEqual ( watcher . watchedPaths , [ ] ) ;
166
+ } ) ;
173
167
174
168
it ( 'should watch files from subprocess IPC events' , async ( ) => {
175
169
const file = fixtures . path ( 'watch-mode/ipc.js' ) ;
0 commit comments