mirror of
https://github.com/jprichardson/node-fs-extra.git
synced 2026-01-25 16:42:57 +00:00
21 lines
593 B
JavaScript
21 lines
593 B
JavaScript
const fs = require('graceful-fs')
|
|
const path = require('path')
|
|
|
|
const { CROSS_DEVICE_PATH } = process.env
|
|
let runCrossDeviceTests = !!CROSS_DEVICE_PATH
|
|
|
|
if (runCrossDeviceTests) {
|
|
// make sure we have permission on device
|
|
try {
|
|
fs.writeFileSync(path.join(CROSS_DEVICE_PATH, 'file'), 'hi')
|
|
} catch {
|
|
runCrossDeviceTests = false
|
|
throw new Error(`Can't write to device ${CROSS_DEVICE_PATH}`)
|
|
}
|
|
} else console.log('Skipping cross-device move tests')
|
|
|
|
module.exports = {
|
|
differentDevice: CROSS_DEVICE_PATH,
|
|
ifCrossDeviceEnabled: (fn) => runCrossDeviceTests ? fn : fn.skip
|
|
}
|