summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-watch-recursive-validate.js
blob: cfebc64818283eaf4f8f576e8b42e2bf33f1aeae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'use strict';

const common = require('../common');

if (common.isIBMi)
  common.skip('IBMi does not support `fs.watch()`');

// fs-watch on folders have limited capability in AIX.
// The testcase makes use of folder watching, and causes
// hang. This behavior is documented. Skip this for AIX.

if (common.isAIX)
  common.skip('folder watch capability is limited in AIX.');

const assert = require('assert');
const path = require('path');
const fs = require('fs');

const tmpdir = require('../common/tmpdir');
const testDir = tmpdir.path;
tmpdir.refresh();

(async () => {
  // Handle non-boolean values for options.recursive

  if (!common.isWindows && !common.isOSX) {
    assert.throws(() => {
      const testsubdir = fs.mkdtempSync(testDir + path.sep);
      fs.watch(testsubdir, { recursive: '1' });
    }, {
      code: 'ERR_INVALID_ARG_TYPE',
    });
  }
})().then(common.mustCall());