diff --git a/client/bin/multi-client.js b/client/bin/multi-client.js index 56329e428..88e9b3a7d 100755 --- a/client/bin/multi-client.js +++ b/client/bin/multi-client.js @@ -370,6 +370,7 @@ class State { case 1: return "1 (error)"; // client/lib/index.js#L401 case 2: return "2 (test failure)"; // client/lib/index.js#L323 case 3: return "3 (test error)"; // client/lib/index.js#L328 + case 4: return "4 (testbot disconnect)"; // client/lib/index.js#L394 default: return `${c.code} (exception)`; // For all other outcomes } }, diff --git a/client/lib/index.js b/client/lib/index.js index fd170e4ff..d0351a75a 100644 --- a/client/lib/index.js +++ b/client/lib/index.js @@ -289,6 +289,7 @@ module.exports = class Client extends PassThrough { }); let capturedError = null; + let testDone = false; const wsMessageHandler = ws => async pkg => { try { const { type, data } = JSON.parse(pkg); @@ -341,6 +342,7 @@ module.exports = class Client extends PassThrough { } else { this.log(`Test suite has exited with: PASS`) } + testDone = true; break; case 'error': process.exitCode = 3; @@ -405,6 +407,11 @@ module.exports = class Client extends PassThrough { ws.on('close', () => { this.log('WS connection is closed'); process.stdin.destroy(); + // give exit code of 4 when WS is closed before tests report as finished + if(!testDone){ + process.exitCode = 4 + } + if (capturedError) { reject(capturedError); } else {