From dd95ad2ba52e32b04341eaf0f351b2dad9ec960c Mon Sep 17 00:00:00 2001 From: Yaroslav Serhieiev Date: Mon, 13 Aug 2018 12:05:33 +0300 Subject: [PATCH] hotfix: remove SIGINT, SIGTERM handling due to #881 (#883) --- detox/src/Detox.js | 5 ----- detox/src/Detox.test.js | 10 ---------- detox/src/index.js | 4 ---- detox/src/index.test.js | 2 -- detox/src/utils/onTerminate.js | 8 -------- 5 files changed, 29 deletions(-) delete mode 100644 detox/src/utils/onTerminate.js diff --git a/detox/src/Detox.js b/detox/src/Detox.js index 441cf7a9f6..5d24c687d4 100644 --- a/detox/src/Detox.js +++ b/detox/src/Detox.js @@ -91,11 +91,6 @@ class Detox { } } - async terminate() { - await this.artifactsManager.onTerminate(); - await this.cleanup(); - } - async beforeEach(testSummary) { this._validateTestSummary(testSummary); this._logTestRunCheckpoint('DETOX_BEFORE_EACH', testSummary); diff --git a/detox/src/Detox.test.js b/detox/src/Detox.test.js index f16ec4d62a..3ee000db95 100644 --- a/detox/src/Detox.test.js +++ b/detox/src/Detox.test.js @@ -243,15 +243,5 @@ describe('Detox', () => { await detox.cleanup(); expect(detox.artifactsManager.onAfterAll).toHaveBeenCalledTimes(1); }); - - it(`Calling .terminate() will trigger artifacts manager .onTerminate()`, async () => { - Detox = require('./Detox'); - - detox = new Detox({deviceConfig: validDeviceConfig}); - detox.artifactsManager.onTerminate = jest.fn(); - - await detox.terminate(); - expect(detox.artifactsManager.onTerminate).toHaveBeenCalledTimes(1); - }); }); }); diff --git a/detox/src/index.js b/detox/src/index.js index ce59e87904..08d4213e9f 100644 --- a/detox/src/index.js +++ b/detox/src/index.js @@ -5,7 +5,6 @@ const platform = require('./platform'); const exportWrapper = require('./exportWrapper'); const argparse = require('./utils/argparse'); const log = require('./utils/logger').child({ __filename }); -const onTerminate = require('./utils/onTerminate'); const configuration = require('./configuration'); let detox; @@ -85,9 +84,6 @@ async function cleanup() { } } -/* istanbul ignore next */ -onTerminate(() => detox && detox.terminate()); - module.exports = Object.assign({ init, cleanup, diff --git a/detox/src/index.test.js b/detox/src/index.test.js index 5ea30b6fad..a82c42ef6a 100644 --- a/detox/src/index.test.js +++ b/detox/src/index.test.js @@ -14,7 +14,6 @@ describe('index', () => { jest .mock('./server/DetoxServer') .mock('./devices/Device') - .mock('./utils/onTerminate') .mock('./utils/logger') .mock('./client/Client') .mock('./Detox', () => jest.fn(() => mockDetox)) @@ -29,7 +28,6 @@ describe('index', () => { jest .unmock('./server/DetoxServer') .unmock('./devices/Device') - .unmock('./utils/onTerminate') .unmock('./client/Client') .unmock('./Detox') .unmock('./platform'); diff --git a/detox/src/utils/onTerminate.js b/detox/src/utils/onTerminate.js deleted file mode 100644 index f7b1fa7425..0000000000 --- a/detox/src/utils/onTerminate.js +++ /dev/null @@ -1,8 +0,0 @@ -const _ = require('lodash'); - -function onTerminate(callback) { - process.on('SIGINT', _.once(callback)); - process.on('SIGTERM', _.once(callback)); -} - -module.exports = onTerminate; \ No newline at end of file