A simple gRPC mock server for Node.js, version 1.0.1. It allows defining rules to match incoming gRPC calls (unary, client-streaming, server-streaming, bidirectional) and return predefined outputs or errors. Built on grpc-kit and @grpc/proto-loader, it requires no actual gRPC service implementation, making it ideal for testing. Compared to alternatives like grpc-mock (original) or protobufjs-based mocks, this package offers a straightforward rule-based API with support for stream types, error responses with metadata, and regex-based input matching. Release cadence is low, with infrequent updates.
npm install grpc-mock-bumpedNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Starts a mock gRPC server with a single unary rule and a regex-based rule, listening on port 50051.
Use npm install grpc-mock-bumped (note the '-bumped' suffix) or switch to the original grpc-mock (older maintenance).
Migrate to grpc-mock-bumped@1.0.1 or consider alternatives like grpc-mock-server.
Always provide an output for client-streaming rules, even if it's an empty object.
Ensure metadata values are strings, e.g., { key: 'value' }.Run npm install grpc-mock-bumped and update imports to import from 'grpc-mock-bumped'.
Ensure you are using the named export: import { createMockServer } from 'grpc-mock-bumped' and calling listen on the returned server instance.Double-check that the method name matches exactly as defined in the .proto file, e.g., 'SayHello' not 'sayHello'.
Verify that the input object matches exactly or use a regex string like '.*' to match any input. For streaming, ensure stream array is correctly defined.