File tree Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change
1
+ * Added ability to force ` interval ` value by setting ` CHOKIDAR_INTERVAL `
2
+ env variable
3
+
1
4
# Chokidar 1.6.0 (Jun 22, 2016)
2
5
* Added ability for force ` usePolling ` mode by setting ` CHOKIDAR_USEPOLLING `
3
6
env variable
Original file line number Diff line number Diff line change @@ -183,7 +183,8 @@ non-standard situations. Setting to `true` explicitly on OS X overrides the
183
183
` useFsEvents ` default. You may also set the CHOKIDAR_USEPOLLING env variable
184
184
to true (1) or false (0) in order to override this option.
185
185
* _ Polling-specific settings_ (effective when ` usePolling: true ` )
186
- * ` interval ` (default: ` 100 ` ). Interval of file system polling.
186
+ * ` interval ` (default: ` 100 ` ). Interval of file system polling. You may also
187
+ set the CHOKIDAR_INTERVAL env variable to override this option.
187
188
* ` binaryInterval ` (default: ` 300 ` ). Interval of file system
188
189
polling for binary files.
189
190
([ see list of binary extensions] ( https://github.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json ) )
Original file line number Diff line number Diff line change @@ -105,6 +105,10 @@ function FSWatcher(_opts) {
105
105
opts . usePolling = ! ! envLower
106
106
}
107
107
}
108
+ var envInterval = process . env . CHOKIDAR_INTERVAL ;
109
+ if ( envInterval ) {
110
+ opts . interval = parseInt ( envInterval ) ;
111
+ }
108
112
109
113
// Editor atomic write normalization enabled by default with fs.watch
110
114
if ( undef ( 'atomic' ) ) opts . atomic = ! opts . usePolling && ! opts . useFsEvents ;
Original file line number Diff line number Diff line change @@ -1877,5 +1877,20 @@ function runTests(baseopts) {
1877
1877
} ) ;
1878
1878
} ) ;
1879
1879
} ) ;
1880
+ describe ( 'CHOKIDAR_INTERVAL' , function ( ) {
1881
+ afterEach ( function ( ) {
1882
+ delete process . env . CHOKIDAR_INTERVAL ;
1883
+ } ) ;
1884
+
1885
+ it ( 'should make options.interval = CHOKIDAR_INTERVAL when it is set' , function ( done ) {
1886
+ options . interval = 100 ;
1887
+ process . env . CHOKIDAR_INTERVAL = 1500 ;
1888
+
1889
+ watcher = chokidar . watch ( fixturesPath , options ) . on ( 'ready' , function ( ) {
1890
+ watcher . options . interval . should . be . equal ( 1500 ) ;
1891
+ done ( ) ;
1892
+ } ) ;
1893
+ } ) ;
1894
+ } ) ;
1880
1895
} ) ;
1881
1896
}
You can’t perform that action at this time.
0 commit comments