diff --git a/lib/fs.js b/lib/fs.js index 29e1a3d2b1d..b907021b5cc 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -629,6 +629,10 @@ fs.watchFile = function(filename) { listener = arguments[1]; } + if (!listener) { + throw new Error('watchFile requires a listener function'); + } + if (options.persistent === undefined) options.persistent = true; if (options.interval === undefined) options.interval = 0;