Skip to content

Commit

Permalink
Really Fixes #368: Mocha 4.0.x: Test process never finishes. Cleaning…
Browse files Browse the repository at this point in the history
… up Detox server by closing ws socket. :P
  • Loading branch information
rotemmiz committed Nov 12, 2017
1 parent 6f8f9b8 commit 7b10cab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions detox-server/src/DetoxServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class DetoxServer {
log.log('wss', `${now()}:`, `role=${otherRole} not connected, cannot fw action (sessionId=${sessionId})`);
}
}

close() {
this.wss.close();
}
}

function now() {
Expand Down
6 changes: 5 additions & 1 deletion detox/src/Detox.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ class Detox {
await this.device._cleanup();
}

if (this.server) {
this.server.close();
}

if (argparse.getArgValue('cleanup') && this.device) {
await this.device.shutdown();
}
Expand All @@ -88,7 +92,7 @@ class Detox {
async beforeEach(...testNameComponents) {
this._currentTestNumber++;
if (this._artifactsPathsProvider !== undefined) {
const testArtifactsPath = this._artifactsPathsProvider.createPathForTest(this._currentTestNumber, ...testNameComponents)
const testArtifactsPath = this._artifactsPathsProvider.createPathForTest(this._currentTestNumber, ...testNameComponents);
this.device.setArtifactsDestination(testArtifactsPath);
}
}
Expand Down

0 comments on commit 7b10cab

Please sign in to comment.