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 fs.rmdir(filePath, { recursive: true }, common.mustCall((err) => { 20 assert.strictEqual(err.code, common.isWindows ? 'ENOENT' : 'ENOTDIR'); 21 })); 22} 23