Skip to content
/ pmpact Public

A command line tool to convert Pact files to Postman collections.

License

Notifications You must be signed in to change notification settings

ITV/pmpact

Folders and files

NameName
Last commit message
Last commit date

Latest commit

cda46c5 · Oct 25, 2024

History

81 Commits
Jun 7, 2024
Aug 31, 2018
Jun 7, 2024
Sep 10, 2021
Apr 4, 2024
Nov 9, 2018
Oct 25, 2024
Oct 25, 2024
Oct 21, 2024
Oct 21, 2024
Apr 20, 2023
Jul 8, 2020

Repository files navigation

pmpact

A command line tool to convert Pact files to Postman collections.

Contents

Requirements

Requires NodeJS version v20.11 or higher.

Installation

npm install -g pmpact

Installation from the repo

Clone the repo and from the root execute:

npm install
npm link

Note: Don't forget to run npm unlink if needed!

Command line usage

From a url

pmpact http://pact-broker/provider/a-provider/consumer/a-consumer/latest

From a file

pmpact pact-file.json

Save to a file

pmpact http://pact-broker/provider/a-provider/consumer/a-consumer/latest -o postman-collection.json

From a url that requires headers

pmpact http://pact-broker/provider/a-provider/consumer/a-consumer/latest -H '{"Authorization":"Basic ZFhmbHR5Rk1n..."}'

Postman usage

Import the collection in Postman

Once you have a generated Postman collection, select "import" in Postman. The generated collection format is 2.1.

A collection should appear, starting with the name "Pact".

Create a Postman environment

A url variable is used for all the requests. The next step is to create an Postman environment with a url variable, for example: url: http://my-service.com.

  1. Image
  2. Image
  3. Image
  4. Image

You're good to go - so make the requests!

Run tests

Run all tests

npm test

Run unit tests only

npm run test-unit

Run integration tests only

npm run test-integration

### Watch tests

npm install -g nodemon
nodemon tests/unit -x "npm run test-unit"
nodemon tests/integration -x "npm run test-integration"

Release process

When contributing, the process we adhere to for releases is found in RELEASE.md.

License

See License file