Registry / testing / testapi6-grpc

testapi6-grpc

JSON →
library1.2.1jsnpmunverified

testapi6-grpc provides gRPC server and client functionality specifically designed for the testapi6 ecosystem. The current stable version is 1.2.1, and it follows the release cadence of the testapi6 package. It integrates tightly with testapi6 (peer dependency ^1.2.51) to enable gRPC-based communication. Unlike general-purpose gRPC libraries, this package is tailored to work within the testapi6 framework, offering simplified setup for test environments or integration tests.

npm install testapi6-grpc
INSTALL
IMPORT
SIG · TESTAPI6-GRPC
T
testapi6-grpc
testingjavascriptv1.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createGrpcServer
import { createGrpcServer } from 'testapi6-grpc'
Primary export for starting a gRPC server
GrpcClient
import { GrpcClient } from 'testapi6-grpc'
const GrpcClient = require('testapi6-grpc').GrpcClient
CommonJS may still work but ESM is preferred
default
import testapi6Grpc from 'testapi6-grpc'
import { default } from 'testapi6-grpc'
Default import accesses the entire module object, not recommended

Shows how to create a gRPC server and client using testapi6-grpc with proto loading and insecure connection.

import { createGrpcServer, GrpcClient } from 'testapi6-grpc'; import { loadPackageDefinition } from '@grpc/grpc-js'; import { loadSync } from '@grpc/proto-loader'; // Start a gRPC server const server = createGrpcServer(); const protoPath = './path/to/service.proto'; const packageDefinition = loadSync(protoPath, {}); const proto = loadPackageDefinition(packageDefinition); server.addService(proto.myService.service, { myMethod: (call, callback) => { callback(null, { message: 'Hello from testapi6-grpc' }); }, }); server.bindAsync('0.0.0.0:50051', server.ServerCredentials.createInsecure(), (err, port) => { if (err) throw err; console.log(`Server listening on port ${port}`); server.start(); }); // Create a client const client = new GrpcClient('localhost:50051', proto.myService, { channelOptions: {} }); client.myMethod({ name: 'World' }, (err, response) => { if (err) throw err; console.log(response.message); });
Debug
Known issues
deprecatedThe 'channelOptions' parameter in GrpcClient constructor is deprecated as of v1.0.3.
fix
Use named options object without channelOptions wrapper.
affects: >=1.0.3
breakingIn v1.2.0, the peer dependency testapi6 was updated to ^1.2.51, breaking compatibility with older testapi6 versions.
fix
Ensure testapi6 version is at least 1.2.51.
affects: >=1.2.0
gotchaThe GrpcClient requires an active gRPC server to be running; client creation does not validate server availability.
fix
Always start the server before creating client instances.
affects: all
breakingDefault export changed from an object to a function in v0.9.0.
fix
Use named exports instead of default import.
affects: >=0.9.0
Errors
Common errors & fixes
Error: Cannot find module 'testapi6'
Missing peer dependency testapi6.
fix
Run 'npm install testapi6@^1.2.51'
TypeError: server.addService is not a function
The createGrpcServer returns a different object than expected, or proto definition is incorrect.
fix
Verify that proto.loadPackageDefinition returns an object with service constructors.
Error: 14 UNAVAILABLE: No connection established
gRPC server not started or wrong address.
fix
Ensure server is running on the expected host:port and client connects to it.
DeprecationWarning: channelOptions is deprecated
Using deprecated parameter in GrpcClient constructor.
fix
Remove channelOptions or use new options API: remove the wrapper.
Upgrade
Version history
1.2.1latest on npm
Audit
Dependencies
testapi6requiredPeer dependency; required core library for gRPC server/client integration
Agent activity
6 hits · last 30 days
node
6
Resources
testapi6-grpc — npm install testapi6-grpc · libregistry