2020-10-16 11:50:00 -06:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const tmpdir = require('../common/tmpdir');
|
2021-02-03 20:18:50 +01:00
|
|
|
const assert = require('assert');
|
2020-10-16 11:50:00 -06:00
|
|
|
const fs = require('fs');
|
|
|
|
|
|
|
|
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 }) ' +
|
2021-02-08 12:24:06 +01:00
|
|
|
'will be removed. Use fs.rm(path, { recursive: true }) instead',
|
2020-10-16 11:50:00 -06:00
|
|
|
'DEP0147'
|
|
|
|
);
|
2021-02-03 20:18:50 +01:00
|
|
|
assert.throws(
|
2023-08-15 22:45:24 +09:00
|
|
|
() => fs.rmdirSync(tmpdir.resolve('noexist.txt'),
|
2021-02-03 20:18:50 +01:00
|
|
|
{ recursive: true }),
|
|
|
|
{ code: 'ENOENT' }
|
|
|
|
);
|
2020-10-16 11:50:00 -06:00
|
|
|
}
|