Skip to content

Commit 38fcee3

Browse files
AWolf81Rokt33r
authored andcommitted
fix test for Windows (fs.rmdir throws dir not empty error)
1 parent 4af7106 commit 38fcee3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/dataApi/copyFile-test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ const copyFile = require('browser/main/lib/dataApi/copyFile')
33

44
const path = require('path')
55
const fs = require('fs')
6+
const os = require('os')
7+
const execSync = require('child_process').execSync
8+
const removeDirCommand = os.platform() === 'win32' ? 'rmdir /s /q ' : 'rm -rf '
69

710
const testFile = 'test.txt'
811
const srcFolder = path.join(__dirname, '🤔')
@@ -29,7 +32,7 @@ test('`copyFile` should handle encoded URI on src path', (t) => {
2932
test.after((t) => {
3033
fs.unlinkSync(srcPath)
3134
fs.unlinkSync(dstPath)
32-
fs.rmdirSync(srcFolder)
33-
fs.rmdirSync(dstFolder)
35+
execSync(removeDirCommand + '"' + srcFolder + '"')
36+
execSync(removeDirCommand + '"' + dstFolder + '"')
3437
})
3538

0 commit comments

Comments
 (0)