Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/runtime-node/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './ipc-host.js';
export * from './parent-port-host.js';
export * from './ws-node-host.js';
export * from './launch-http-server.js';
Expand Down
61 changes: 0 additions & 61 deletions packages/runtime-node/src/ipc-host.ts

This file was deleted.

53 changes: 2 additions & 51 deletions packages/runtime-node/test/node-com.unit.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { createDisposables } from '@dazl/create-disposables';
import {
BaseHost,
Communication,
Environment,
WsClientHost,
socketClientInitializer,
type DisposeMessage,
type Message,
} from '@dazl/engine-core';
import { IPCHost, WsServerHost } from '@dazl/engine-runtime-node';
import { createDisposables } from '@dazl/create-disposables';
import { WsServerHost } from '@dazl/engine-runtime-node';
import { createWaitForCall } from '@dazl/wait-for-call';
import { expect } from 'chai';
import { safeListeningHttpServer } from 'create-listening-server';
import { fork } from 'node:child_process';
import type { Socket } from 'node:net';
import { waitFor } from 'promise-assist';
import sinon, { spy } from 'sinon';
Expand Down Expand Up @@ -321,50 +319,3 @@ describe('Socket communication', () => {
expect(secondClient.isConnected(), 'second connected').to.eql(true);
});
});

describe('IPC communication', () => {
const disposables = createDisposables();
afterEach(() => disposables.dispose());

it('communication with forked process', async () => {
const mainHost = new BaseHost();
const communication = new Communication(mainHost, 'main');
const forked = fork(new URL('./process-entry.js', import.meta.url));
disposables.add(() => forked.kill());
const host = new IPCHost(forked);
communication.registerEnv('process', host);
communication.registerMessageHandler(host);
const proxy = communication.apiProxy<{ echo(): string }>(
{
id: 'process',
},
{ id: 'myApi' },
);

expect(await proxy.echo()).to.eq('yo');
});

it('handles forked process closing', async () => {
const mainHost = new BaseHost();
const communication = new Communication(mainHost, 'main');
const forked = fork(new URL('./process-entry.js', import.meta.url));
const host = new IPCHost(forked);
communication.registerEnv('process', host);
communication.registerMessageHandler(host);
const proxy = communication.apiProxy<{ echo(): string }>(
{
id: 'process',
},
{ id: 'myApi' },
);

forked.kill();
const { waitForCall, spy } = createWaitForCall<(e: Error) => void>();
proxy.echo().catch(spy);
await waitForCall((args) => {
expect(args[0].message).to.have.string(
'Remote call failed in "process" - environment disconnected at "main"',
);
});
});
});
11 changes: 0 additions & 11 deletions packages/runtime-node/test/process-entry.ts

This file was deleted.