Connectum API Reference / @connectum/testing / index / createTestServer
Function: createTestServer()
createTestServer(
options):Promise<TestServer>
Defined in: test-server.ts:33
Create and start a test server on a random (or specified) port.
Returns a TestServer with a pre-configured gRPC transport ready for use with ConnectRPC clients. The caller is responsible for calling TestServer.close when done.
Parameters
options
Server configuration (services, interceptors, protocols, port)
Returns
Promise<TestServer>
Running test server with transport and cleanup function
Example
typescript
const server = await createTestServer({ services: [myRoutes] });
const client = createClient(MyService, server.transport);
const response = await client.myMethod({ id: "1" });
await server.close();