1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

fix test for Windows (fs.rmdir throws dir not empty error)

This commit is contained in:
AWolf81
2019-05-30 09:31:56 +02:00
committed by Junyoung Choi
parent 4af7106e01
commit 38fcee35c2

View File

@@ -3,6 +3,9 @@ const copyFile = require('browser/main/lib/dataApi/copyFile')
const path = require('path')
const fs = require('fs')
const os = require('os')
const execSync = require('child_process').execSync
const removeDirCommand = os.platform() === 'win32' ? 'rmdir /s /q ' : 'rm -rf '
const testFile = 'test.txt'
const srcFolder = path.join(__dirname, '🤔')
@@ -29,7 +32,7 @@ test('`copyFile` should handle encoded URI on src path', (t) => {
test.after((t) => {
fs.unlinkSync(srcPath)
fs.unlinkSync(dstPath)
fs.rmdirSync(srcFolder)
fs.rmdirSync(dstFolder)
execSync(removeDirCommand + '"' + srcFolder + '"')
execSync(removeDirCommand + '"' + dstFolder + '"')
})