Skip to content

Commit

Permalink
fix: Flaky test on CI due to process timeout
Browse files Browse the repository at this point in the history
This commit fixes the flaky CI test due to the termination of JSON-RPC
client (mock-host) before the server actually processes all requests.
  • Loading branch information
Keen Yee Liau authored and IgorMinar committed Aug 23, 2018
1 parent f0d3e2a commit 28bcb8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: node_js
sudo: false

node_js:
- '6.9'
- '8.11'

env:
matrix:
Expand All @@ -28,4 +28,4 @@ deploy:
file: dist/ngls.vsix
on:
repo: angular/vscode-ng-language-service
tags: true
tags: true
8 changes: 4 additions & 4 deletions tests/tools/mock-host/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ try {
content = content.replace(RE_PWD, args['pwd']);
}
const json = JSON.parse(content);

if (Array.isArray(json)) {
for (const message of json) {
writer.write(message as any);
}
}

// Do not terminate the process for 5 seconds to allow messages to
// Do not terminate the process for 10 seconds to allow messages to
// propagate. vscode-jsonrpc detects the process exit and terminates
// the service. This prevents the detection from causing the test
// to fail.
setTimeout(() => {}, 5000);
setTimeout(() => {}, 10000);
} catch(e) {
console.error(`Error: ${e.message}`);
process.exit(2);
}
}

0 comments on commit 28bcb8e

Please sign in to comment.