Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
fix: replace mkdirp with fs.mkdir (#36)
Browse files Browse the repository at this point in the history
Also drop the dev dependency rimraf in favor of fs.rm
  • Loading branch information
lukekarrys authored Feb 7, 2023
1 parent dc3d1b9 commit 78fd1bf
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lib/recorder.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict'

const fs = require('fs')
const mkdirp = require('mkdirp').sync
const nock = require('nock')
const path = require('path')

Expand Down Expand Up @@ -150,7 +149,7 @@ class NockRecorder {
nock.activate()
// this will only run when the root test is being torn down, which means everything
// else is finished and now we just need to actually write the snapshot file
mkdirp(path.dirname(this.#snapshotFile))
fs.mkdirSync(path.dirname(this.#snapshotFile), { recursive: true })
fs.writeFileSync(this.#snapshotFile, JSON.stringify(this.#snapshot, null, 2))
}
}
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.11.3",
"minipass-fetch": "^3.0.0",
"rimraf": "^3.0.2",
"tap": "^16.0.1"
},
"dependencies": {
"mkdirp": "^1.0.4",
"nock": "^13.2.4"
},
"files": [
Expand Down
3 changes: 1 addition & 2 deletions test/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const fs = require('fs')
const http = require('http')
const fetch = require('minipass-fetch')
const path = require('path')
const rimraf = require('rimraf').sync
const patchTap = require('../')
const t = patchTap(require('tap'))
const Test = t.Test
Expand All @@ -15,7 +14,7 @@ const server = http.createServer((req, res) => {
})

const flushSnapshots = () => {
rimraf(path.resolve(__dirname, '../tap-snapshots'))
fs.rmSync(path.resolve(__dirname, '../tap-snapshots'), { force: true, recursive: true })
}

t.afterEach(flushSnapshots)
Expand Down

0 comments on commit 78fd1bf

Please sign in to comment.