Skip to content

Commit 47b928c

Browse files
authored
deps: replace node builtin rmSync with rimraf (#412)
This avoids the EBUSY issue during "spawn daemon" test mentioned in #408
1 parent 1ef54ba commit 47b928c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"mutate-fs": "^2.1.1",
3434
"nock": "^13.2.4",
3535
"npm-registry-mock": "^1.3.2",
36+
"rimraf": "^6.0.1",
3637
"tap": "^16.0.1"
3738
},
3839
"files": [

test/git.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ const fs = require('node:fs')
33
const http = require('node:http')
44
const { dirname, basename, resolve } = require('node:path')
55
const { mkdir } = require('node:fs/promises')
6-
const { rmSync } = require('node:fs')
76
const { spawn } = require('node:child_process')
87
const Arborist = require('@npmcli/arborist')
98
const HostedGit = require('hosted-git-info')
109
const npa = require('npm-package-arg')
1110
const spawnGit = require('@npmcli/git').spawn
11+
const rimraf = require('rimraf')
1212
const tar = require('tar')
1313
const spawnNpm = require('../lib/util/npm.js')
1414
const GitFetcher = require('../lib/git.js')
@@ -229,7 +229,8 @@ t.test('setup', { bail: true, skip: isWindows && 'posix only' }, t => {
229229
}
230230
daemon.stderr.on('data', onDaemonData)
231231
// only clean up the dir once the daemon is banished
232-
daemon.on('close', () => rmSync(me, { recursive: true, force: true }))
232+
// do NOT replace this with node's internal rmSync. It generates EBUSY errors in windows.
233+
daemon.on('close', () => rimraf.sync(me))
233234
})
234235

235236
t.test('create a repo with a submodule', () => {

0 commit comments

Comments
 (0)