mirror of https://github.com/lukechilds/node.git
Browse Source
When the listener was truthy but NOT a function, fs.watchFile would throw an error through the EventEmitter. This caused a problem because it would only be thrown after the listener was started, which left the listener on. There should be no backwards compatability issues because the error was always thrown, just in a different manner. Also adds tests for this and other basic functionality. PR-URL: https://github.com/nodejs/io.js/pull/2093 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>v4.0.0-rc
2 changed files with 24 additions and 8 deletions
@ -0,0 +1,17 @@ |
|||
'use strict'; |
|||
|
|||
const fs = require('fs'); |
|||
const assert = require('assert'); |
|||
|
|||
// Basic usage tests.
|
|||
assert.throws(function() { |
|||
fs.watchFile('./some-file'); |
|||
}, /watchFile requires a listener function/); |
|||
|
|||
assert.throws(function() { |
|||
fs.watchFile('./another-file', {}, 'bad listener'); |
|||
}, /watchFile requires a listener function/); |
|||
|
|||
assert.throws(function() { |
|||
fs.watchFile(new Object(), function() {}); |
|||
}, /Path must be a string/); |
Loading…
Reference in new issue