🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

pact-bun

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pact-bun

Pact 🔗 Contract Testing for Bun 🥟, Powered by Rust 🦀

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

pact-bun

Pact Contract Testing with Bun

Logo

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

Pre-Reqs

  • Bun for your platform
  • Pact FFI Library
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

  • git clone git@github.com:YOU54F/pact-bun.git
  • cd pact-bun
  • bun install
  • 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

FAQs

Package last updated on 10 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts