From 38c72b57834e1e3bf05b83986a1d7880ee42298f Mon Sep 17 00:00:00 2001 From: Liang Gong Date: Fri, 29 Sep 2023 13:27:19 -0700 Subject: [PATCH] fix(api): fix node deprecation warning Summary: Got this warning when running tests: ``` memlab/api: (node:2218786) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead ``` Reviewed By: tulga1970 Differential Revision: D49710277 fbshipit-source-id: 680e8a861b47dd150a8f0f89bea6ba2918cd6e1a --- .../__tests__/API/E2EFindMemoryLeaksWithSnapshotFiles.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/api/src/__tests__/API/E2EFindMemoryLeaksWithSnapshotFiles.test.ts b/packages/api/src/__tests__/API/E2EFindMemoryLeaksWithSnapshotFiles.test.ts index 06a1d981d..bba561e44 100644 --- a/packages/api/src/__tests__/API/E2EFindMemoryLeaksWithSnapshotFiles.test.ts +++ b/packages/api/src/__tests__/API/E2EFindMemoryLeaksWithSnapshotFiles.test.ts @@ -57,7 +57,7 @@ test( newSnapshotFiles.push(newFile); fs.moveSync(file, newFile); }); - fs.rmdirSync(result.getRootDirectory(), {recursive: true}); + fs.removeSync(result.getRootDirectory()); // find memory leaks with the new snapshot files const leaks = await findLeaksBySnapshotFilePaths( @@ -76,7 +76,7 @@ test( expect(leaks.some(leak => JSON.stringify(leak).includes('_path_2'))); // finally clean up the temporary directory - fs.rmdirSync(tmpDir, {recursive: true}); + fs.removeSync(tmpDir); }, testTimeout, );