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  assert.throws(
12    () =>
13      fs.rmdirSync(path.join(tmpdir.path, 'noexist.txt'), { recursive: true }),
14    {
15      code: 'ENOENT',
16    }
17  );
18}
19{
20  fs.rmdir(
21    path.join(tmpdir.path, 'noexist.txt'),
22    { recursive: true },
23    common.mustCall((err) => {
24      assert.strictEqual(err.code, 'ENOENT');
25    })
26  );
27}
28{
29  assert.rejects(
30    () => fs.promises.rmdir(path.join(tmpdir.path, 'noexist.txt'),
31                            { recursive: true }),
32    {
33      code: 'ENOENT',
34    }
35  ).then(common.mustCall());
36}
37