From ee0f3c0692eeca081cefa2b413074d3e506f7705 Mon Sep 17 00:00:00 2001 From: Rotem M Date: Sun, 10 Jun 2018 12:05:32 +0300 Subject: [PATCH] Ensure device.registry.state.lock path exists before clearing it --- detox/local-cli/detox-test.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/detox/local-cli/detox-test.js b/detox/local-cli/detox-test.js index 03c66ea10c..f073316871 100644 --- a/detox/local-cli/detox-test.js +++ b/detox/local-cli/detox-test.js @@ -3,7 +3,7 @@ const program = require('commander'); const path = require('path'); const cp = require('child_process'); - +const fs = require('fs-extra'); const _ = require('lodash'); const CustomError = require('../src/errors/CustomError'); const environment = require('../src/utils/environment'); @@ -167,8 +167,9 @@ function getPlatformSpecificString(platform) { function clearDeviceRegistryLockFile() { - const fs = require('fs'); - fs.writeFileSync(environment.getDeviceLockFilePath(), '[]'); + const lockFilePath = environment.getDeviceLockFilePath(); + fs.ensureFileSync(lockFilePath); + fs.writeFileSync(lockFilePath, '[]'); } function getDefaultConfiguration() {