Remove adb reverse from test setup

Summary:
The bash file was running adb reverse on the oneworld devices.

Switching to use the real code to do this instead.

--forceExit is needed because the dispatcher keeps an open handle on the adb connection, and it doesn't expose a close() method to stop it. I'm not sure of the best way to fix that, but it's out of scope for this diff anyway.

Reviewed By: passy

Differential Revision: D10868563

fbshipit-source-id: fb44ff1353d5050bb7967cb6c4fa18c2e5d0d149
This commit is contained in:
John Knox
2018-10-31 08:52:50 -07:00
committed by Facebook Github Bot
parent f88aa99d2a
commit b3f9bd9ee1
2 changed files with 8 additions and 2 deletions

View File

@@ -102,7 +102,7 @@
"fix": "eslint . --fix", "fix": "eslint . --fix",
"test": "jest --testPathPattern=node\\.js$ --no-cache", "test": "jest --testPathPattern=node\\.js$ --no-cache",
"test-electron": "jest --testPathPattern=electron\\.js$ --testEnvironment=@jest-runner/electron/environment --runner=@jest-runner/electron --no-cache", "test-electron": "jest --testPathPattern=electron\\.js$ --testEnvironment=@jest-runner/electron/environment --runner=@jest-runner/electron --no-cache",
"test-with-device": "USE_ELECTRON_STUBS=1 jest --testPathPattern=device\\.js$ --detectOpenHandles --no-cache", "test-with-device": "USE_ELECTRON_STUBS=1 jest --testPathPattern=device\\.js$ --detectOpenHandles --forceExit --no-cache",
"lint": "eslint . && flow check" "lint": "eslint . && flow check"
}, },
"optionalDependencies": { "optionalDependencies": {

View File

@@ -12,6 +12,7 @@ import configureStore from 'redux-mock-store';
import path from 'path'; import path from 'path';
import os from 'os'; import os from 'os';
import fs from 'fs'; import fs from 'fs';
import androidDevice from '../dispatcher/androidDevice';
let server; let server;
const mockStore = configureStore([])(reducers(undefined, {type: 'INIT'})); const mockStore = configureStore([])(reducers(undefined, {type: 'INIT'}));
@@ -23,7 +24,12 @@ beforeAll(() => {
fs.mkdirSync(flipperDir); fs.mkdirSync(flipperDir);
} }
server = new Server(new LogManager(), mockStore); const logger = new LogManager();
// Set up android dispatcher, which does the adb reversing.
androidDevice(mockStore, logger);
server = new Server(logger, mockStore);
return server.init(); return server.init();
}); });