Registry / testing / grpc-cucumber-js

grpc-cucumber-js

JSON →
library2.1.0jsnpmunverified

A Gherkin-based testing framework for gRPC API integration testing using cucumber-js. This package enables writing Cucumber feature files for gRPC services, providing step definitions and utilities. Current stable version is 2.1.0, with a low release cadence. Key differentiators: native gRPC support for Cucumber, proto file parsing, and request/response validation.

npm install grpc-cucumber-js
INSTALL
IMPORT
SIG · GRPC-CUCUMBER-JS
G
grpc-cucumber-js
testingjavascriptv2.1.0
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.

grpcCucumber
import grpcCucumber from 'grpc-cucumber-js'
Default export may be used in ESM
GrpcCucumber
import { GrpcCucumber } from 'grpc-cucumber-js'
Named export
grpcCucumber
const grpcCucumber = require('grpc-cucumber-js')
const { grpcCucumber } = require('grpc-cucumber-js')
Require returns the default export; destructuring may be incorrect

Demonstrates how to configure grpc-cucumber-js with proto file and register step definitions.

// Usage in a Cucumber configuration file (e.g., cucumber.js) const grpcCucumber = require('grpc-cucumber-js'); // Configure gRPC client const clientConfig = { protoPath: `${__dirname}/path/to/your/service.proto`, packageName: 'your.package', serviceName: 'YourService', address: process.env.GRPC_ADDRESS ?? 'localhost:50051', }; // Register step definitions grpcCucumber.defineSteps({ clientConfig }); // In feature file: // Feature: gRPC service // Scenario: Call SayHello // When I call gRPC method "SayHello" with request: // | name | value | // | name | John | // Then the response status should be OK // And the response field "message" should equal "Hello, John"
Debug
Known issues
gotchaProto file path must be absolute or relative correctly. Ensure proto imports are resolved.
fix
Use `path.resolve()` or provide absolute path to proto file.
affects: >=1.0.0
gotchaStep definitions must be registered before running Cucumber. Register in a support file or hooks.
fix
Put `grpcCucumber.defineSteps()` in a Cucumber support file (e.g., features/support/steps.js).
affects: >=1.0.0
deprecatedThe `defineSteps` method signature may change in future versions. Check documentation.
fix
Refer to current API docs for updated signatures.
affects: >=2.0.0
gotchaRequires @cucumber/cucumber version that supports custom step definitions. Incompatible with older Cucumber versions.
fix
Use @cucumber/cucumber >=7.0.0.
affects: >=2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'grpc-cucumber-js'
Package not installed or import path incorrect.
fix
Run `npm install grpc-cucumber-js` and ensure node_modules includes it.
TypeError: grpcCucumber.defineSteps is not a function
Import method mismatch: using destructured require but default export is the function.
fix
Use `const grpcCucumber = require('grpc-cucumber-js')` without destructuring.
Error: ENOENT: no such file or directory, open 'proto/service.proto'
Proto file path not resolved correctly.
fix
Provide an absolute path using `__dirname` or `path.resolve()`.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies
@cucumber/cucumberrequiredCore dependency for Cucumber test runner and step definitions
@grpc/grpc-jsrequiredgRPC client implementation for making API calls
Agent activity
11 hits · last 30 days
node
10
Resources
grpc-cucumber-js — npm install grpc-cucumber-js · libregistry