Skip to content

Commit

Permalink
fix tests for newer node
Browse files Browse the repository at this point in the history
  • Loading branch information
feross committed Feb 12, 2024
1 parent 863472d commit 58716c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions test/unzip.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fs.mkdirSync(tmpPath, { recursive: true })

test('unzipSync', function (t) {
const tmpFilePath = path.join(tmpPath, 'file.txt')
fs.rmdirSync(tmpFilePath, { recursive: true })
fs.rmSync(tmpFilePath, { recursive: true, force: true })
zip.unzipSync(fileZipPath, tmpPath)

const tmpFile = fs.readFileSync(tmpFilePath)
Expand All @@ -25,7 +25,7 @@ test('unzip', function (t) {
t.plan(3)

const tmpFilePath = path.join(tmpPath, 'file.txt')
fs.rmdir(tmpFilePath, { recursive: true }, function (err) {
fs.rm(tmpFilePath, { recursive: true }, function (err) {
t.error(err)

zip.unzip(fileZipPath, tmpPath, function (err) {
Expand All @@ -42,12 +42,16 @@ test('unzip', function (t) {
test('unzip from a folder with a space in it', function (t) {
t.plan(4)

const zipSpacePath = path.join(tmpPath, 'folder space', path.basename(fileZipPath))
const zipSpacePath = path.join(
tmpPath,
'folder space',
path.basename(fileZipPath)
)
fs.mkdirSync(path.dirname(zipSpacePath), { recursive: true })
fs.copyFileSync(fileZipPath, zipSpacePath)

const tmpFilePath = path.join(tmpPath, 'file.txt')
fs.rmdir(tmpFilePath, { recursive: true }, function (err) {
fs.rm(tmpFilePath, { recursive: true }, function (err) {
t.error(err)

zip.unzip(zipSpacePath, tmpPath, function (err) {
Expand Down
4 changes: 2 additions & 2 deletions test/zip.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test('zipSync', function (t) {
zip.zipSync(filePath, tmpFileZipPath)

const tmpFilePath = path.join(tmpPath, 'file.txt')
fs.rmdirSync(tmpFilePath, { recursive: true })
fs.rmSync(tmpFilePath, { recursive: true, force: true })
zip.unzipSync(tmpFileZipPath, tmpPath)

const tmpFile = fs.readFileSync(tmpFilePath)
Expand All @@ -31,7 +31,7 @@ test('zip', function (t) {
t.error(err)

const tmpFilePath = path.join(tmpPath, 'file.txt')
fs.rmdir(tmpFilePath, { recursive: true }, function (err) {
fs.rm(tmpFilePath, { recursive: true }, function (err) {
t.error(err)

zip.unzip(tmpFileZipPath, tmpPath, function (err) {
Expand Down

0 comments on commit 58716c5

Please sign in to comment.