0.0.3 • Published 1 year ago

pact-bun v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

pact-bun

Pact Contract Testing with Bun

Try out Pact-Bun in your browser, via our interactive tutorial

Pre-Reqs

OSArchitectureSupported
OSXx86_64
OSXarm
Linuxx86_64
Linuxarm
Windowsx86_64
  • Bun only supports Windows via WSL.
  • You can use pact-js / deno-pact as alternative TypeScript/JavaScript Pact libraries.

You can install the correct FFI library with the following command.

deno run -A --unstable https://deno.land/x/pact/src/downloadFfi.ts --run
  • Checks if it exists in ${HOME}/.pact/ffi/<pact_ffi_version>
  • Downloads the necessary library for your architecture
  • Executes the library to ensure it works

Installing

In a new project:

bun init
bun add pact-bun

In an new project:

bun add pact-bun

How to get started

  • bun run helloPactBun.ts
import { PactBun, Pact } from "pact-bun";
const pact = new PactBun();
console.log(pact.getPactFfiVersion());
  • bun run helloPactBun.ts

Examples

Run an example by

  1. git clone git@github.com:YOU54F/pact-bun.git
  2. cd pact-bun
  3. bun install
  4. bun run <name of test>

gRPC Area Calculator

bun run src/grpc.consumer.test.ts

HTTP service

bun run src/http.consumer.test.ts

Pact Verifications

bun run src/verifier.test.ts

Docker

If you want to try out a Pact Broker to publish, view and retrieve your pact files, you can try out this quick start quick.

You'll need docker-compose.

  • curl pact.saf.dev -Lso - | bash -s -- broker deploy mybroker 8000
0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago