Skip to content

Commit

Permalink
test: use mustNotCall() in test-fs-watch
Browse files Browse the repository at this point in the history
Use common.mustNotCall() in test/sequential/test-fs-watch.js in
situations where the call to watch() is expected to throw.

PR-URL: #13595
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and addaleax committed Jun 21, 2017
1 parent 7874360 commit 80fa13b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/sequential/test-fs-watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ fs.watch(__filename, {persistent: false}, function() {
// https://github.com/joyent/node/issues/6690
let oldhandle;
assert.throws(function() {
const w = fs.watch(__filename, common.noop);
const w = fs.watch(__filename, common.mustNotCall());
oldhandle = w._handle;
w._handle = { close: w._handle.close };
w.close();
}, /^TypeError: Illegal invocation$/);
oldhandle.close(); // clean up

assert.throws(function() {
const w = fs.watchFile(__filename, {persistent: false}, common.noop);
const w = fs.watchFile(__filename, {persistent: false}, common.mustNotCall());
oldhandle = w._handle;
w._handle = { stop: w._handle.stop };
w.stop();
Expand Down

0 comments on commit 80fa13b

Please sign in to comment.