summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-rmdir-recursive-sync-warns-not-found.js
blob: 449ae0b448b35321baa846273bf8ab48940843e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';
const common = require('../common');
const tmpdir = require('../common/tmpdir');
const fs = require('fs');
const path = require('path');

tmpdir.refresh();

{
  // Should warn when trying to delete a nonexistent path
  common.expectWarning(
    'DeprecationWarning',
    'In future versions of Node.js, fs.rmdir(path, { recursive: true }) ' +
    'will throw if path does not exist or is a file. Use fs.rm(path, ' +
    '{ recursive: true, force: true }) instead',
    'DEP0147'
  );
  fs.rmdirSync(path.join(tmpdir.path, 'noexist.txt'), { recursive: true });
}