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