Freedom251 › Contract Testing Tools
BBC Consumer Contracts

What BBC Consumer Contracts is
BBC Consumer Contracts is a JavaScript package for defining and running consumer-driven checks against APIs. A contract records a consumer, a name, a request, and the response that consumer expects. When executed, it makes an HTTP request with the request package and checks the result with Joi. Checks can cover the response status code, headers, and JSON body, with Joi schemas describing the expected body. This lets a project verify that an API response matches the needs expressed by its consumers.
Contracts can include optional before and after functions for setup and cleanup. Those functions can use callbacks or asynchronous behavior. Retry settings accept a number or a custom option; the documented maximum retry default is zero. The command line tool can run all contracts recursively in a contracts directory or execute one contract file. Code can instead call validateContracts with an array; it processes every contract in that array rather than stopping after the first failure.
The package supports consumer verification and self-hosted deployment. It is free, with the Consumer Contracts plan priced at $0. Runtime requirements are Node.js 18 or later and pnpm 10 or later. The project is licensed under Apache License 2.0; the BBC can be contacted about an alternative licence.
Who it suits
It suits JavaScript teams that need executable API contracts to check whether responses meet consumer expectations. Teams can run checks through the command line or call the package from code, and can host it themselves.
What it does well
- Checks response status codes, headers, and JSON bodies.
- Joi schemas validate API response content.
- Optional functions support contract setup and cleanup.
- CLI can run a directory or one contract file.
- Programmatic validation processes every contract in an array.
- Supports self-hosted deployment and consumer verification.
What to know first
- Requires Node.js 18 or later and pnpm 10 or later.
- Contracts use JavaScript format.
- Default maximum retries is zero.
Plans
| Plan | Billed and limits | Price |
|---|---|---|
| Consumer Contracts | No paid plans or usage limits stated | Free |
As github.com lists them, read 8 Oct 2026. The maker's own page has the final word.
Getting started
- Use a Node.js 18-or-later environment with pnpm 10 or later.
- Install the package globally for command-line use or locally as a development dependency with pnpm.
- Define a JavaScript contract with consumer, name, request, and response properties.
- Run the CLI against a contracts directory or a single contract file, or call validateContracts with an array.
Verdict
Choose BBC Consumer Contracts if you need a free, self-hosted way to express consumer expectations as executable JavaScript API checks. Its request and Joi integrations cover response codes, headers, and JSON bodies, with both command-line and programmatic execution. Consider another option if your runtime does not meet the Node.js and pnpm requirements or you need a non-JavaScript contract format.
Questions
What does BBC Consumer Contracts cost?
The Consumer Contracts plan is free. No paid plans or usage limits are stated.
What platforms does it support?
It supports API and self-hosted use.
What runtime does it require?
The package metadata specifies Node.js 18 or later and pnpm 10 or later.
Which integrations does it use?
It uses the request package to make HTTP requests and Joi to validate API responses.
What license does it use?
The repository license identifies Apache License 2.0. The BBC can be contacted about an alternative licence.
How can contracts be run?
The command line tool runs a contracts directory recursively or a specified file. Programmatic use is available through validateContracts, which runs every contract in the supplied array.
Facts from BBC Consumer Contracts's own pages
- CLI
- The command line tool can run all contracts recursively from a contracts directory or run a single contract by filename. · github.com, 8 Oct 2026
- Command line
- The consumer-contracts run command validates contracts recursively in a contracts directory or can run a specified contract file. · github.com, 7 Oct 2026
- Contract fields
- Each contract requires a consumer name, contract name, request, and response. · github.com, 8 Oct 2026
- Founded
- 2017 · github.com, 28 Sept 2026
- Installation
- The README documents global CLI and local development dependency installation with pnpm. · github.com, 8 Oct 2026
- Integrations
- The project uses the request HTTP client and Joi for response validation. · github.com, 8 Oct 2026
- License
- The repository license identifies Apache License 2.0 and says to contact the BBC for an alternative licence. · github.com, 8 Oct 2026
- Programmatic use
- The package exposes validateContracts for validating an array of contracts in application code. · github.com, 8 Oct 2026
- Purpose
- Consumer Contracts lets API consumers define executable JavaScript contracts describing the responses they expect from services. · github.com, 8 Oct 2026
- Response checks
- Response validation can cover status codes, headers, and JSON bodies. · github.com, 8 Oct 2026
- Retries
- Contracts support fixed or custom retry logic, with the maximum retries defaulting to 0. · github.com, 8 Oct 2026
- Runtime requirements
- The package metadata specifies Node.js version 18 or later and pnpm version 10 or later. · github.com, 8 Oct 2026
- Security
- The README shows SSL request configuration options, including client certificates and a strictSSL setting, but states no security certification or compliance claim. · github.com, 8 Oct 2026
- Security configuration
- Request options may include SSL configuration, and the README documents setting strictSSL to false when strict trust checking is not required. · github.com, 7 Oct 2026
- Setup and cleanup
- Contracts can run asynchronous or callback based setup before execution and cleanup afterward. · github.com, 8 Oct 2026
- Validation
- It uses HTTP requests and Joi schemas to validate API responses. · github.com, 8 Oct 2026
Where BBC Consumer Contracts stands on Freedom251
- Contract Testing Tools#6 of 22