0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-fs-watch-ref-unref.js
rickyes be7fd2d517
fs: add .ref() and .unref() methods to watcher classes
PR-URL: https://github.com/nodejs/node/pull/33134
Fixes: https://github.com/nodejs/node/issues/33096
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-05-09 07:59:08 +02:00

21 lines
349 B
JavaScript

'use strict';
const common = require('../common');
if (common.isIBMi)
common.skip('IBMi does not support `fs.watch()`');
const fs = require('fs');
const watcher = fs.watch(__filename, common.mustNotCall());
watcher.unref();
setTimeout(
common.mustCall(() => {
watcher.ref();
watcher.unref();
}),
common.platformTimeout(100)
);