Skip to content

Commit

Permalink
fix(test-utils): use stdio transport for test server
Browse files Browse the repository at this point in the history
Using the IPC transport, breaks code coverage. This is related to
bcoe/c8#189.
  • Loading branch information
remcohaszing committed May 6, 2024
1 parent b2dbca9 commit f46d411
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/test-utils/index.ts
Expand Up @@ -12,16 +12,17 @@ export function startLanguageServer(serverModule: string, cwd?: string | URL) {

const childProcess = cp.fork(
serverModule,
['--node-ipc', `--clientProcessId=${process.pid.toString()}`],
['--stdio', `--clientProcessId=${process.pid.toString()}`],
{
execArgv: ['--nolazy'],
env: process.env,
cwd,
stdio: 'pipe',
}
);
const connection = _.createProtocolConnection(
new _.IPCMessageReader(childProcess),
new _.IPCMessageWriter(childProcess)
childProcess.stdout!,
childProcess.stdin!
);
const openedDocuments = new Map<string, TextDocument>();
const settings: any = {};
Expand All @@ -34,7 +35,7 @@ export function startLanguageServer(serverModule: string, cwd?: string | URL) {
connection.onUnhandledNotification(e => console.log(e));
connection.onError(e => console.log(e));
connection.onDispose(() => {
childProcess.kill();
connection.end();
});
connection.onRequest(_.ConfigurationRequest.type, ({ items }) => {
return items.map(item => {
Expand Down

0 comments on commit f46d411

Please sign in to comment.