Skip to content

Commit 49eb79a

Browse files
kyliauKeen Yee Liau
authored andcommitted
test: kill server instance after each test
Currently we spawn a new process for the language server for each test. However, they are all kept alive. This PR fixes the resource leak by killing the server after each test.
1 parent a20dba1 commit 49eb79a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

integration/lsp/test_utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ export function createConnection(serverOptions: ServerOptions): MessageConnectio
4242
// execArgv: ['--inspect-brk=9229']
4343
});
4444

45-
return createMessageConnection(
45+
const connection = createMessageConnection(
4646
new IPCMessageReader(server),
4747
new IPCMessageWriter(server),
4848
);
49+
connection.onDispose(() => {
50+
server.kill();
51+
});
52+
return connection;
4953
}
5054

5155
export function initializeServer(client: MessageConnection): Promise<lsp.InitializeResult> {

0 commit comments

Comments
 (0)