# @code-like-a-carpenter/contract-tests

> Jest-compatible alternative to Dredd.

Latest version **2.5.1** (published 2026-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @code-like-a-carpenter/contract-tests
pnpm add @code-like-a-carpenter/contract-tests
yarn add @code-like-a-carpenter/contract-tests
bun add @code-like-a-carpenter/contract-tests
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.5.1 |
| Published | 2026-09-12 |
| First published | 2023-03-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | 22.x |
| Dependencies | 4 |
| Unpacked size | 75.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 0 |
| Author | Ian Remmel |
| Maintainers | ianwremmel |

## Links

- npm: https://www.npmjs.com/package/@code-like-a-carpenter/contract-tests
- Repository: https://github.com/code-like-a-carpenter/workbench
- Homepage: https://www.github.com/code-like-a-carpenter/workbench/tree/main/packages/@code-like-a-carpenter/contract-tests
- Issues: https://www.github.com/code-like-a-carpenter/workbench/issues
- npm.io page: https://npm.io/package/@code-like-a-carpenter/contract-tests

## Dependencies (4)

- [gavel](https://npm.io/package/gavel.md) ^10.0.4
- [jest-diff](https://npm.io/package/jest-diff.md) ^29.5.0
- [dredd-transactions](https://npm.io/package/dredd-transactions.md) ^10.1.0
- [@code-like-a-carpenter/assert](https://npm.io/package/@code-like-a-carpenter/assert.md) 2.4.1

## Recent versions

- 2.5.1 (latest) — 2026-09-12
- 2.5.0 — 2025-04-11
- 2.4.0 — 2024-06-11
- 2.3.1 — 2024-06-08
- 2.3.0 — 2024-06-08
- 2.2.7 — 2024-06-02
- 2.2.6 — 2024-03-23
- 2.2.5 — 2024-03-23
- 2.2.4 — 2024-03-15
- 2.2.3 — 2024-03-15
- 2.2.2 — 2024-02-07
- 2.2.1 — 2024-02-03
- 2.2.0 — 2024-02-02
- 2.1.0 — 2024-02-02
- 2.0.0 — 2024-01-23
- … 4 more at https://npm.io/package/@code-like-a-carpenter/contract-tests/versions

## README

# @code-like-a-carpenter/contract-tests

[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)

> Jest-compatible alternative to Dredd.

API Blueprint is (usually) easier to write than OpenAPI and there's already
tooling out there to turn it into tests. Unfortunately, it's difficult to debug
when something fails (especially in a before hook), doesn't make it easy to run
a specific test, and is just generally frustrating.

Its parser and compiler, however, are separate from its CLI, so this package use
them to generate Jest tests from your API Blueprint.

## Table of Contents

-   [Install](#install)
-   [Usage](#usage)
-   [Maintainer](#maintainer)
-   [Contributing](#contributing)
-   [License](#license)

## Install

```bash
npm i @code-like-a-carpenter/contract-tests
```

## Usage

Create your jest test file, but instead of writing explicit tests, import
`buildContractTests` and pass it your API Blueprint and your API base url.

> Make sure to pass the full path to your API Blueprint file, not a relative
> path.

```ts
import path from 'node:path';

import {buildContractTests} from '@code-like-a-carpenter/contract-tests';

describe('contract tests', () => {
    buildContractTests({
        baseUrl: process.env.API_URL,
        blueprint: path.join(__dirname, 'api.apib'),
    });
});
```

## Maintainer

[Ian Remmel](https://www.ianwremmel.com)

## Contributing

Please see contributing guidelines at the
[project homepage](https://www.github.com/code-like-a-carpenter/workbench/).

## License

MIT © [Ian Remmel](https://www.ianwremmel.com) 2023 until at least now

---
_Source: https://npm.io/package/@code-like-a-carpenter/contract-tests · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
