typescript: handle indexer crashes in tests
If the indexer throws during a test, ensure that the test suite
fails gracefully.
@@ -91,10 +91,15 @@ function verify(
shell: true,
});
+ try {
indexer.index(compilationUnit, new Map(), testFiles, program, (obj: {}) => {
verifier.stdin.write(JSON.stringify(obj) + '\n');
}, plugins);
+ } finally {
+ // Ensure we close stdin on the verifier even on crashes, or otherwise
+ // we hang waiting for the verifier to complete.
verifier.stdin.end();
+ }
return new Promise<void>((resolve, reject) => {
verifier.on('close', (exitCode) => {
