From 4e529367a6421587d28180f77957fb2ae91f6e01 Mon Sep 17 00:00:00 2001 From: Marc Bernard <59966492+mbtools@users.noreply.github.com> Date: Fri, 22 Nov 2024 12:27:14 -0500 Subject: [PATCH 1/2] chore: replace rmSync with rimraf --- package.json | 1 + test/git.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 335c7a6c..7a840494 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "mutate-fs": "^2.1.1", "nock": "^13.2.4", "npm-registry-mock": "^1.3.2", + "rimraf": "^6.0.1", "tap": "^16.0.1" }, "files": [ diff --git a/test/git.js b/test/git.js index c48d402f..56891b3e 100644 --- a/test/git.js +++ b/test/git.js @@ -3,12 +3,12 @@ const fs = require('node:fs') const http = require('node:http') const { dirname, basename, resolve } = require('node:path') const { mkdir } = require('node:fs/promises') -const { rmSync } = require('node:fs') const { spawn } = require('node:child_process') const Arborist = require('@npmcli/arborist') const HostedGit = require('hosted-git-info') const npa = require('npm-package-arg') const spawnGit = require('@npmcli/git').spawn +const rimraf = require('rimraf') const tar = require('tar') const spawnNpm = require('../lib/util/npm.js') const GitFetcher = require('../lib/git.js') @@ -221,7 +221,7 @@ t.test('setup', { bail: true }, t => { } daemon.stderr.on('data', onDaemonData) // only clean up the dir once the daemon is banished - daemon.on('close', () => rmSync(me, { recursive: true, force: true })) + daemon.on('close', () => rimraf.sync(me)) }) t.test('create a repo with a submodule', () => { From a8a633cb008780464f2cd4e383b836f57c65ff1e Mon Sep 17 00:00:00 2001 From: Marc Bernard <59966492+mbtools@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:53:38 -0500 Subject: [PATCH 2/2] add comment Co-authored-by: Gar --- test/git.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/git.js b/test/git.js index 56891b3e..a180f63e 100644 --- a/test/git.js +++ b/test/git.js @@ -221,6 +221,7 @@ t.test('setup', { bail: true }, t => { } daemon.stderr.on('data', onDaemonData) // only clean up the dir once the daemon is banished + // do NOT replace this with node's internal rmSync. It generates EBUSY errors in windows. daemon.on('close', () => rimraf.sync(me)) })