From f6ff666a943212bcbc091305881e4998a95c766a Mon Sep 17 00:00:00 2001 From: Yaroslav Serhieiev Date: Thu, 21 Apr 2022 15:20:52 +0300 Subject: [PATCH] chore: remove dead code --- detox/src/utils/sh.js | 18 ------------------ detox/src/utils/sh.test.js | 26 -------------------------- 2 files changed, 44 deletions(-) delete mode 100644 detox/src/utils/sh.js delete mode 100644 detox/src/utils/sh.test.js diff --git a/detox/src/utils/sh.js b/detox/src/utils/sh.js deleted file mode 100644 index 78f3f30395..0000000000 --- a/detox/src/utils/sh.js +++ /dev/null @@ -1,18 +0,0 @@ -// @ts-nocheck -const cpp = require('child-process-promise'); - -const sh = new Proxy({}, { - get: function(target, prop) { - if (target[prop] === undefined) { - return target[prop] = (...params) => { - return cpp.exec(`${prop} ${params.join(' ')}`); - }; - } else { - return target[prop]; - } - } -}); - -process.env['PATH'] = `${process.env.PATH}:${sh.npm(`bin`)}`; - -module.exports = sh; diff --git a/detox/src/utils/sh.test.js b/detox/src/utils/sh.test.js deleted file mode 100644 index d48e829cfc..0000000000 --- a/detox/src/utils/sh.test.js +++ /dev/null @@ -1,26 +0,0 @@ -describe('sh', () => { - let sh; - let cpp; - - beforeEach(() => { - jest.mock('child-process-promise'); - cpp = require('child-process-promise'); - sh = require('./sh'); - }); - - it(`Call an undefined function with one string param should generate a full command string`, async () => { - await sh.cp('path/to/src pat/to/dest'); - expect(cpp.exec).toHaveBeenCalledWith('cp path/to/src pat/to/dest'); - }); - - it(`Call an undefined function with two string params should generate a full command string`, async () => { - await sh.cp('-r', 'path/to/src pat/to/dest'); - expect(cpp.exec).toHaveBeenCalledWith('cp -r path/to/src pat/to/dest'); - }); - - it(`Require an undefined param from sh and then initiate it as function should generate a full command string`, async () => { - const npm = require('./sh').npm; - await npm('-v'); - expect(cpp.exec).toHaveBeenCalledWith('npm -v'); - }); -});