diff --git a/test/sequential/test-fs-watch.js b/test/sequential/test-fs-watch.js index ff0a52c89c6790..8c543a2a17290a 100644 --- a/test/sequential/test-fs-watch.js +++ b/test/sequential/test-fs-watch.js @@ -125,9 +125,31 @@ tmpdir.refresh(); w.close(); }, { + name: 'Error', + code: 'ERR_INTERNAL_ASSERTION', message: /^handle must be a FSEvent/, + } + ); + oldhandle.close(); // clean up +} + +{ + let oldhandle; + assert.throws( + () => { + const w = fs.watch(__filename, common.mustNotCall()); + oldhandle = w._handle; + const protoSymbols = + Object.getOwnPropertySymbols(Object.getPrototypeOf(w)); + const kFSWatchStart = + protoSymbols.find((val) => val.toString() === 'Symbol(kFSWatchStart)'); + w._handle = {}; + w[kFSWatchStart](); + }, + { name: 'Error', code: 'ERR_INTERNAL_ASSERTION', + message: /^handle must be a FSEvent/, } ); oldhandle.close(); // clean up