mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 10:16:26 +00:00
fix test for Windows (fs.rmdir throws dir not empty error)
This commit is contained in:
@@ -3,6 +3,9 @@ const copyFile = require('browser/main/lib/dataApi/copyFile')
|
|||||||
|
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const fs = require('fs')
|
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 testFile = 'test.txt'
|
||||||
const srcFolder = path.join(__dirname, '🤔')
|
const srcFolder = path.join(__dirname, '🤔')
|
||||||
@@ -29,7 +32,7 @@ test('`copyFile` should handle encoded URI on src path', (t) => {
|
|||||||
test.after((t) => {
|
test.after((t) => {
|
||||||
fs.unlinkSync(srcPath)
|
fs.unlinkSync(srcPath)
|
||||||
fs.unlinkSync(dstPath)
|
fs.unlinkSync(dstPath)
|
||||||
fs.rmdirSync(srcFolder)
|
execSync(removeDirCommand + '"' + srcFolder + '"')
|
||||||
fs.rmdirSync(dstFolder)
|
execSync(removeDirCommand + '"' + dstFolder + '"')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user