1'use strict';
2const common = require('../common');
3const tmpdir = require('../common/tmpdir');
4const assert = require('assert');
5const fs = require('fs');
6const path = require('path');
7
8tmpdir.refresh();
9
10{
11  common.expectWarning(
12    'DeprecationWarning',
13    'In future versions of Node.js, fs.rmdir(path, { recursive: true }) ' +
14      'will be removed. Use fs.rm(path, { recursive: true }) instead',
15    'DEP0147'
16  );
17  const filePath = path.join(tmpdir.path, 'rmdir-recursive.txt');
18  fs.writeFileSync(filePath, '');
19  assert.throws(
20    () => fs.rmdirSync(filePath, { recursive: true }),
21    { code: common.isWindows ? 'ENOENT' : 'ENOTDIR' }
22  );
23}
24