Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@pact-foundation/pact-cli

pact-foundation139.8kMIT16.0.7TypeScript support: included

Broker CLI for @pact-foundation/pact

pact, node, wrapper, mock, service, provider, verifier

readme

Pact CLI

Pact CLI Tools

This package wraps the Pact Standalone Tools so that they are available to node scripts in package.json, and linked binaries in the standard NPM installation directory (e..g. ./node_modules/.bin).

For example:

"scripts": {
  "pactPublish": "pact-broker publish ./pacts --consumer-app-version=$\(git describe\) --broker-base-url=$BROKER_BASE_URL --broker-username=$BROKER_USERNAME --broker-password=BROKER_PASSWORD"`
}

Or:


```sh
# Example can-i-deploy check
./node_modules/.bin/pact-broker can-i-deploy --pacticipant "Banana Service" --broker-base-url https://test.pact.dius.com.au --latest --broker-username dXfltyFMgNOFZAxr8io9wJ37iUpY42M --broker-password O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1

Computer says no ¯\_(ツ)_/¯

CONSUMER       | C.VERSION | PROVIDER       | P.VERSION | SUCCESS?
---------------|-----------|----------------|-----------|---------
Banana Service | 1.0.0     | Fofana Service | 1.0.0     | false

The verification between the latest version of Banana Service (1.0.0) and version 1.0.0 of Fofana Service failed

The following are the binaries currently made available:

  • pact-mock-service
  • pact-broker
  • pact-stub-service
  • pact-message
  • pact-provider-verifier
  • pact

Pact-CLI API

A wrapper for the Pact CLI Tools.

Installation

npm install @pact-foundation/pact-cli --save-dev

Do Not Track

In order to get better statistics as to who is using Pact, we have an anonymous tracking event that triggers when Pact installs for the first time. To respect your privacy, anyone can turn it off by simply adding a 'do not track' flag within their package.json file:

{
 "name": "some-project",
 ...
 "config": {
  "pact_do_not_track": true
 },
 ...
}

Which Library/Package should I use?

pact-js for core contract testing functionality pact-cli for broker client tools, either standalone or as a JavaScript API.

Usage

Simply require the library and call the create function to start the mock service

var pact = require("@pact-foundation/pact-cli");
var server = pact.createServer({ port: 9999 });
server.start().then(function() {
 // Do your testing/development here
});

Or if you're using Typescript instead of plain old Javascript

import pact from "@pact-foundation/pact-cli";
const server = pact.createServer({ port: 9999 });
server.start().then(() => {
 // Do your testing/development here
});

Or you can also use the CLI

$# pact mock --port 9999

To see the list commands possible with the CLI, simply ask for help $# pact --help

Documentation

Set Log Level

var pact = require("@pact-foundation/pact-cli");
pact.logLevel("debug");

or you can set it via an environment variable

LOG_LEVEL=debug

Pact Broker Publishing

var pact = require('@pact-foundation/pact-core');
var opts = {
 ...
};

pact.publishPacts(opts).then(function () {
 // do something
});

Options:

Parameter Required? Type Description
pactFilesOrDirs true array Array of local Pact files or directories containing them. Required.
pactBroker true string URL of the Pact Broker to publish pacts to. Required.
consumerVersion true string A string containing a semver-style version e.g. 1.0.0. Required.
pactBrokerUsername false string Username for Pact Broker basic authentication. Optional
pactBrokerPassword false string Password for Pact Broker basic authentication. Optional
pactBrokerToken false string Bearer token for Pact Broker authentication. Optional
tags false array An array of Strings to tag the Pacts being published. Optional
branch false string The branch to associate with the published pacts. Optional but recommended
autoDetectVersionProperties false boolean Automatically detect the repository branch from known CI environment variables or git CLI. Supports Buildkite, Circle CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor, GitLab, CodeShip, Bitbucket and Azure DevOps. Optional
buildUrl false string The build URL that created the pact. Optional
verbose false boolean Enables verbose output for underlying pact binary.

Pact Broker Deployment Check

var pact = require('@pact-foundation/pact-core');
var opts = {
 ...
};

pact.canDeploy(opts)
 .then(function (result) {
  // You can deploy this
    // If output is not specified or is json, result describes the result of the check.
    // If outout is 'table', it is the human readable string returned by the check
 })
 .catch(function(error) {
  // You can't deploy this
    // if output is not specified, or is json, error will be an object describing
    // the result of the check (if the check failed),
    // if output is 'table', then the error will be a string describing the output from the binary,

    // In both cases, `error` will be an Error object if something went wrong during the check.
 });

Options:

Parameter Required? Type Description
pacticipants true []objects An array of version selectors in the form `{ name: String, latest?: string
| | specify a tag, use the tagname with latest. Specify one of these per pacticipant
| | that you want to deploy
pactBroker true string URL of the Pact Broker to query about deployment. Required.
pactBrokerUsername false string Username for Pact Broker basic authentication. Optional
pactBrokerPassword false string Password for Pact Broker basic authentication. Optional
pactBrokerToken false string Bearer token for Pact Broker authentication. Optional
output false json,table Specify output to show, json or table. Optional, Defaults to json.
verbose false boolean Enables verbose output for underlying pact binary.
retryWhileUnknown false number The number of times to retry while there is an unknown verification result. Optional
retryInterval false number The time between retries in seconds, use with retryWhileUnknown. Optional
to false string The tag that you want to deploy to (eg, 'prod')

Mock Servers

Mock servers are used by Pact to record interactions and create pact contracts.

Create Mock Server

var pact = require('@pact-foundation/pact-cli');
var server = pact.createServer({
 ...
});

Options:

Parameter Required? Type Description
port false number Port number that the server runs on, defaults to random available port
host false string Host on which to bind the server on, defaults to 'localhost'. Supports '0.0.0.0' to bind on all IPv4 addresses on the local machine.
log false string File to log output on relative to current working directory, defaults to none
logLevel false LogLevel (string) Log level to pass to the pact core. One of "DEBUG", "ERROR", "WARN", "INFO", can be set by LOG_LEVEL env var
ssl false boolean Create a self-signed SSL cert to run the server over HTTPS , defaults to false
sslcert false string Path to a custom self-signed SSL cert file, 'ssl' option must be set to true to use this option, defaults to none
sslkey false string Path a custom key and self-signed SSL cert key file, 'ssl' option must be set to true to use this, defaults to none
cors false boolean Allow CORS OPTION requests to be accepted, defaults to 'false'
dir false string Directory to write the pact contracts relative to the current working directory, defaults to none
spec false number The pact specification version to use when writing pact contracts, defaults to '1'
consumer false string The name of the consumer to be written to the pact contracts, defaults to none
provider false string The name of the provider to be written to the pact contracts, defaults to none
pactFileWriteMode false overwrite OR update OR merge Control how the pact file is created. Defaults to "overwrite"
format false json OR xml Format to write the results as, either in JSON or XML, defaults to JSON
out false string Write output to a file instead of returning it in the promise, defaults to none
timeout false number How long to wait for the mock server to start up (in milliseconds). Defaults to 30000 (30 seconds)

List Mock Servers

If you ever need to see which servers are currently created.

var pact = require("@pact-foundation/pact-cli");
var servers = pact.listServers();
console.log(JSON.stringify(servers));

Remove All Mock Servers

Remove all servers once you're done with them in one fell swoop.

var pact = require("@pact-foundation/pact-cli");
pact.removeAllServers();

Start a Mock Server

Start the current server.

var pact = require("@pact-foundation/pact-cli");
pact.createServer()
 .start()
 .then(function() {
  // Do something after it started
 });

Stop a Mock server

Stop the current server.

var pact = require("@pact-foundation/pact-cli");
pact.createServer()
 .stop()
 .then(function() {
  // Do something after it stopped
 });

Delete a Mock server

Stop the current server and deletes it from the list.

var pact = require("@pact-foundation/pact-cli");
pact.createServer()
 .delete()
 .then(function() {
  // Do something after it was killed
 });

Check if a Mock server is running

var pact = require("@pact-foundation/pact-cli");
pact.createServer().running;

Mock Server Events

There's 3 different events available, 'start', 'stop' and 'delete'. They can be listened to the same way as an EventEmitter.

var pact = require("@pact-foundation/pact-cli");
var server = pact.createServer();
server.on("start", function() {
 console.log("started");
});
server.on("stop", function() {
 console.log("stopped");
});
server.on("delete", function() {
 console.log("deleted");
});

Stub Servers

Stub servers create runnable APIs from existing pact files.

The interface is comparable to the Mock Server API.

Create Stub Server

var pact = require('@pact-foundation/pact-cli');
var server = pact.createStub({
 ...
});

Options:

Parameter Required? Type Description
pactUrls true array List of local Pact files to create the stub service from
port false number Port number that the server runs on, defaults to random available port
host false string Host on which to bind the server on, defaults to 'localhost'. Supports '0.0.0.0' to bind on all IPv4 addresses on the local machine.
log false string File to log output on relative to current working directory, defaults to none
logLevel false LogLevel (string) Log level to pass to the pact core. One of "DEBUG", "ERROR", "WARN", "INFO", can be set by LOG_LEVEL env var
ssl false boolean Create a self-signed SSL cert to run the server over HTTPS , defaults to 'false'
sslcert false string Path to a custom self-signed SSL cert file, 'ssl' option must be set to true to use this option. Defaults false
sslkey false string Path a custom key and self-signed SSL cert key file, 'ssl' option must be set to true to use this option false. Defaults to none
cors false boolean Allow CORS OPTION requests to be accepted, defaults to 'false'
timeout false number How long to wait for the stub server to start up (in milliseconds). Defaults to 30000 (30 seconds)

Message Pacts

Create Message Pacts

var pact = require('@pact-foundation/pact-cli');
var message = pact.createMessage({
 ...
});

Options:

Parameter Required? Type Description
dir true string Directory to write the pact contracts relative to the current working directory, defaults to none
consumer true string The name of the consumer to be written to the pact contracts, defaults to none
provider true string The name of the provider to be written to the pact contracts, defaults to none
pactFileWriteMode false `"overwrite" "update"
Example
const messageFactory = messageFactory({
 consumer: "consumer",
 provider: "provider",
 dir: dirname(`${__filename}/pacts`),
 content: `{
  "description": "a test mesage",
  "content": {
   "name": "Mary"
  }
 }`
});

messageFactory.createMessage();

Windows Issues

Enable Long Paths

Windows has a default path length limit of 260 causing issues with projects that are nested deep inside several directory and with how npm handles node_modules directory structures. To fix this issue, please enable Windows Long Paths in the registry by running regedit.exe, find the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled and change the value from 0 to 1, then reboot your computer. Pact should now work as it should, if not, please raise an issue on github.

Contributing

To develop this project, simply install the dependencies with npm install --ignore-scripts, and run npm run watch to for continual development, linting and testing when a source file changes.

Testing

Running npm test will execute the tests that has the *.spec.js pattern.

Questions?

Please search for potential answers or post question on our official Pact StackOverflow.

changelog

Changelog

All notable changes to this project will be documented in this file. See commit-and-tag-version for commit guidelines.

16.0.7 (2025-03-11)

Fixes and Improvements

  • update standalone to 2.4.24 (b8cbcef)

16.0.6 (2025-03-04)

Fixes and Improvements

  • update standalone to 2.4.23 (39d9782)

16.0.5 (2025-02-24)

Fixes and Improvements

  • deps: update dependency cross-spawn to v7.0.6 (1adbeba)
  • deps: update dependency pino to v9.6.0 (416a8eb)
  • update standalone to 2.4.20 (5816c44)
  • update standalone to 2.4.22 (53f28a1)

16.0.4 (2024-11-12)

Fixes and Improvements

  • deps: update check-types / mkdirp / pino / underscore (6f6dc54)

16.0.3 (2024-10-24)

Fixes and Improvements

  • update standalone to 2.4.16 (1e23ed5)

16.0.2 (2024-10-23)

Fixes and Improvements

  • update standalone to 2.4.15 (c7de0bf)

16.0.1 (2024-09-30)

Fixes and Improvements

  • update standalone to 2.4.14 (89009c4)

16.0.0 (2024-09-06)

⚠ BREAKING CHANGES

  • create os/arch specific npm optional deps for pact-ruby-standalone

Features

  • create os/arch specific npm optional deps for pact-ruby-standalone (cb3a26d)

15.0.5 (2024-08-21)

Fixes and Improvements

  • update standalone to 2.4.12 (73a2169)

15.0.4 (2024-08-12)

Fixes and Improvements

  • update standalone to 2.4.11 (d473dc9)
  • update standalone to 2.4.9 (71e499c)

15.0.3 (2024-06-25)

Fixes and Improvements

  • use full path to pactflow binary as it may be invoked from anywhere via npx (c3bc9a0)

15.0.2 (2024-06-17)

Fixes and Improvements

  • update standalone to 2.4.6 (2a988c0)

15.0.1 (2024-06-12)

Fixes and Improvements

  • deps: update rimraf to 4.4.1 to avoid glob warnings (5ddc257)

15.0.0 (2024-06-12)

⚠ BREAKING CHANGES

  • remove ia32 cpu type
  • lock engines to node 16 or greater
  • Remove everything except for the CLI binstubs
  • setLogLevel no longer accepts or returns a number
  • The verbose option has been removed, as it is now implied by logLevel of DEBUG or TRACE
  • All logging and reporting is now on standard out. This was the default before. This means the logDir / format / out options are no longer supported. If your ecosystem needs the ability to customise logging and reporting, please let us know by opening an issue.
  • The undocumented option monkeypatch has been removed. The use cases for this feature are mostly covered by other options.
  • customProviderHeaders has been removed. Please see the request filter documentation in pact-js.
  • All the interfaces that previously returned q.Promise have now been replaced with native es6 Promises. Calling code will need to be updated.
  • All options deprecated in previous versions have been removed. Migration instructions:

  • In VerifierOptions: replace use of tags, consumerVersionTag and providerVersionTag with the appropriate consumerVersionTags or providerVersionTags option.

  • The following classes have had their .create(options) removed. Please use the appropriate constructor instead (for example, new Verifier(options))

    • Verifier
    • Publisher
    • Server
    • Stub
  • docs: The type for consumer version selectors in the verifier has been corrected. This will affect typescript users who were using consumerVersionSelectors with the fields pacticipant, all or version. These fields never worked, and now will no longer compile in typescript. The correct type is:
ConsumerVersionSelector {
  tag?: string;
  latest?: boolean;
  consumer?: string;
  fallbackTag?: string;
}

Note that pacticipant, version and all have been removed. Existing code that uses pacticipant needs to use consumer instead. The other fields can be dropped. Any questions, please reach out to us at https://slack.pact.io/

  • fix https://github.com/pact-foundation/pact-js-core/issues/285
  • can-i-deploy: Options for CanDeploy have changed. Now, pacticipants are specified by an array of { name: <string>, latest?: <string | boolean>, version?: <string> }, allowing more than one pacticipant to be specified. You must specify one of latest or version. If latest is true, the latest pact is used. If it is string, then the latest pact with that tag is used.
  • CanDeploy: CanDeploy now defaults to json output (and returns the parsed object as the result of the promise. If you were using CanDeploy and relied on parsing the logged output, you will need to explicitly set output: table in your CanDeploy options.
  • verifier: removal of Broker class

  • Add migration docs and update readme (e589c01)

  • docs: Add description of consumer version selectors to the documentation. (1bdb45d)

Features

  • All Pact-CLI functionality has been moved to pact-js-cli repository.

    • API/CLI interface remain.

    @pact-foundation/pact-core imports will now become @pact-foundation/pact-cli

14.3.7 (2024-05-29)

Fixes and Improvements

14.3.6 (2024-05-09)

Fixes and Improvements

  • update pact-ffi to 0.4.20 (7a91725)

14.3.5 (2024-05-08)

Fixes and Improvements

  • node doesn't run .bat files on windows (#504) (4f125b3)

14.3.4 (2024-04-23)

Fixes and Improvements

  • normalise PREBUILD_NAME to node.napi (3812b0d)
  • upgrade to latest ffi 0.4.19 (7a7d9b0)

14.3.3 (2024-03-25)

Fixes and Improvements

  • export pactffiMessageGivenWithParams (9b77d8c)

14.3.2 (2024-03-14)

Fixes and Improvements

14.3.1 (2024-03-13)

Fixes and Improvements

  • 🐛 avoid node-gyp rebuild install script (f5f5e7c)
  • update standalone to 2.4.2 (#492) (fcccc34)

14.3.0 (2024-02-28)

Features

  • add pactffi_message_with_metadata_v2 (#493) (613b7bd)

14.2.0 (2024-02-19)

Features

  • support status code matcher via pactffi_response_status_v2 (#486) (0edd3ac)

14.1.4 (2024-02-13)

Fixes and Improvements

  • update standalone to 2.4.1 (8dfad86)

14.1.3 (2024-02-12)

Fixes and Improvements

  • update pact-ffi to 0.4.16 (502f354)
  • update standalone to 2.4.0 (f9a8e27)

14.1.2 (2024-02-07)

Fixes and Improvements

  • upgrade to latest ffi 0.4.15 (1ebdc49)

14.1.1 (2024-01-22)

Fixes and Improvements

  • pactffi_given_with_params accepts 3 args (a56fdf7)
  • update standalone to 2.1.0 (6b49009)

14.1.0 (2024-01-18)

Features

  • add pactffi_given_with_params for params (#476) (ed8dea8)

14.0.6 (2024-01-17)

Fixes and Improvements

  • update standalone to 2.0.7 (3234fae)
  • upgrade to latest ffi 0.4.12 (94447f4)

14.0.5 (2023-09-24)

Fixes and Improvements

  • upgrade to latest ffi 0.4.9 (6ddfda7)

14.0.4 (2023-07-27)

Fixes and Improvements

14.0.3 (2023-07-14)

Fixes and Improvements

  • update standalone to 2.0.3 (b16a450)

14.0.2 (2023-07-13)

Fixes and Improvements

  • upgrade to latest ffi 0.4.6 (56e3f4b)

14.0.1 (2023-07-07)

Fixes and Improvements

  • set engines in package.json not engine (4c9cc69)

14.0.0 (2023-07-07)

⚠ BREAKING CHANGES

  • drop support for node 15 and earlier

Fixes and Improvements

  • drop support for node 15 and earlier (5fa91db)
  • improve logging output for pact ffi native library lookup (fb4e338)

13.15.0 (2023-07-06)

Features

  • allow setting of LOG_LEVEL env var (7224770)
  • ARM64 Linux/MacOS Pact Ruby Standalone (ea9f86f)
  • Prebuild pact_ffi pact.node - (6a38cf7)

Fixes and Improvements

  • path lookup for binaries was incorrectly munging into a single path (7203e10)

13.14.0 (2023-07-06)

Features

  • Allow setting of LOG_LEVEL env var (7224770)
  • Support arm64 Linux/MacOS CLI (Pact Ruby Standalone) (ea9f86f)
  • Prebuild native dependencies to speed up and simplify install (6a38cf7)

13.13.9 (2023-06-30)

Fixes and Improvements

  • update standalone to 2.0.2 (a6133f1)

13.13.8 (2023-04-24)

Fixes and Improvements

  • update standalone to 1.92.0 (0287ce8)

13.13.7 (2023-04-24)

Fixes and Improvements

  • Remove unusable external export of HTTPConfig, which removes the need to have needle types as a dependency (f123204)
  • upgrade to latest needle to support no_proxy. Fixes #351 (30f46d0)

13.13.6 (2023-03-14)

Fixes and Improvements

  • Use synchronous logging to allow usage with Jest (a4899f4)

13.13.5 (2023-03-08)

Fixes and Improvements

  • Fix an issue where invalid VerifierOptions keys with Array values would cause a TypeError (4ecc29f)

13.13.4 (2023-01-23)

Fixes and Improvements

  • Fix 'is not a function' regression when using require() and a directly exported factory function. Fixes #426 (2941552)
  • update rust core to 0.4.0 (3b396cd)

13.13.3 (2022-12-23)

Fixes and Improvements

  • use newer pactffi_with_header_v2 ffi method (b579e4d)

13.13.2 (2022-12-22)

Fixes and Improvements

  • upgrade to latest ffi 0.3.19 (1c5a4fe)

13.13.1 (2022-12-19)

Fixes and Improvements

  • update rust core to 0.3.18 (d178c27)

13.13.0 (2022-12-02)

Features

  • new content mismatch types for plugins (7cebccd)

Fixes and Improvements

  • pactffi_create_mock_server_for_transport returns uint32 (8d85a81)

13.12.2 (2022-11-28)

Fixes and Improvements

13.12.1 (2022-11-24)

Fixes and Improvements

  • upgrade to latest pino. Fixes 417 (2de141c)

13.12.0 (2022-11-08)

Features

  • support HTTP + non-HTTP in ConsumerPact (56786f2)

13.11.3 (2022-11-07)

Fixes and Improvements

13.11.2 (2022-11-04)

Fixes and Improvements

  • restore ConsumerMessage type (alias) (f44283d)

13.11.1 (2022-11-02)

Fixes and Improvements

  • restore makeConsumerAsyncMessagePact (1c4a893)

13.11.0 (2022-10-31)

Features

  • add additional FFI methods to support plugins (246e86f)
  • support branch/autoDetectVersionProperties when publishing pacts (64ab2ea)

Fixes and Improvements

  • Add error messages to the ignored option debug logs (8c8386d)

13.10.0 (2022-10-18)

Features

  • expose faiIfNoPactsFound on the VerifierOptions (72eeb08)

Fixes and Improvements

  • only set failIfNoPactsFound if set by user (577e49f)

13.9.1 (2022-09-28)

Fixes and Improvements

13.9.0 (2022-09-07)

Features

  • support PACT_BROKER_PUBLISH_VERIFICATION_RESULTS (64872ae)

Fixes and Improvements

  • update standalone to 1.91.0 (c6d747f)
  • upgrade to ffi 0.3.11 (550e4b3)

13.8.0 (2022-09-05)

Features

  • Add Linux/arm64 support (a174d7b)

13.7.9 (2022-08-30)

Fixes and Improvements

  • error if file source is invalid (f1ad86a)
  • update rust core to 0.3.9 (81483b8)

13.7.8 (2022-08-19)

Fixes and Improvements

  • correct binary matching behaviour (5794c74)

13.7.7 (2022-08-14)

Fixes and Improvements

  • update FFI core and fix order of verifier FFI calls (3a70f2e)

13.7.6 (2022-08-13)

Fixes and Improvements

  • validateOptions should ignore unknown properties (8e2af40)

13.7.5 (2022-08-13)

Fixes and Improvements

  • restore providerVersionBranch (c155f94)
  • support customProviderHeaders as a string[] (171cfd0)

13.7.4 (2022-08-13)

Fixes and Improvements

  • corrects customProviderHeaders validation (pact-foundation/pact-js-core#392) (#393) (f77dd65)

13.7.3 (2022-08-12)

Fixes and Improvements

  • update the argument validation and function mapping for ffi verification (#391) (fee85e1)

13.7.2 (2022-08-11)

Fixes and Improvements

  • verifier: Fix issue where using custom provider headers would cause a crash (fixes #388) (c4f60f2)

13.7.1 (2022-08-09)

Fixes and Improvements

  • map pactflow command to correct binary / add tests (31f4df9)

13.7.0 (2022-08-09)

Features

  • expose pactflow pact-ruby-standalone command (d9f9fc7)

13.6.2 (2022-07-06)

Fixes and Improvements

13.6.1 (2022-07-04)

Fixes and Improvements

  • send NUL terminated strings to pactffi_message_with_contents for non-binary payloads (ac4557c)
  • update standalone to 1.88.91-rc4 (#378) (f9344ea)
  • update standalone to 1.89.01-rc1 (#381) (8f70fa3)

13.6.0 (2022-03-21)

Features

  • add plugin consumer native methods (aeef054)
  • add plugin to consumer interfaces (ea0f536)
  • add test for protobufs/plugin (6bf78d8)
  • bump native version to 0.1.6 (d59d1a6)
  • message pact interface (76baab8)
  • support custom provider headers in verification (d63e1a9)

Fixes and Improvements

13.5.1 (2022-03-15)

Fixes and Improvements

  • update standalone to 1.88.83 (423817d)

13.5.0 (2022-02-21)

Features

  • collect usage telemetry data (f97e114)

Fixes and Improvements

13.4.1 (2021-12-16)

Fixes and Improvements

  • update standalone to 1.88.81 (9abfa06)

13.4.0 (2021-12-14)

Features

  • Add buildUrl option to Pact Broker Publishing API (58be64a)

Fixes and Improvements

  • update standalone to 1.88.80 (c0332e8)

13.3.0 (2021-10-29)

Features

  • Add new branch consumerVersionSelector options to verifier (c3872be)

Fixes and Improvements

  • Bump version of Pact FFI to 0.0.3 (bc74026)
  • update standalone to 1.88.78 (cb25136)

13.2.1 (2021-10-18)

Fixes and Improvements

  • publisher: Fix an issue that caused the publisher API to reject with the most recent binaries (As an aside, the recommended approach is to use the CLI not the API for almost all use cases- see the examples for more details) (4a100bb)
  • Substantially improve error messages if the pact publisher API fails (81d3511)

13.2.0 (2021-10-16)

Features

  • Add a beta interface to the FFI / V3 Consumer tests. Try it out with import { makeConsumerPact } from 'pact-core/src/consumer' (46d6667)
  • Revert the consumer changes until the issues with node 14 are fixed (the release notes about the V3 consumer support in this release are not true, sorry) (dc5217d)

Fixes and Improvements

  • Pass logLevel down to the native consumer (88b329c)
  • Pin standalone version back to the last known good version 1.88.66 (77eab71)
  • update standalone to 1.88.68 (5f38729)
  • update standalone to 1.88.69 (ceb7071)
  • update standalone to 1.88.70 (138a2c4)
  • update standalone to 1.88.71 (850178d)
  • update standalone to 1.88.72 (f8d0d0f)
  • update standalone to 1.88.73 (4ba164d)
  • update standalone to 1.88.75 (c2fc6ac)
  • update standalone to 1.88.76 (eea5c54)
  • update standalone to 1.88.77 (9659f35)
  • verifier: Correctly pass down log levels to the native core (c11ce75)
  • verifier: Correctly pass down log levels to the native core (13d5ded)
  • Warn if broker arguments are set without a broker URL and ignore the argument (fixes pact-foundation/pact-js#760) (17d3eb1)

13.1.7 (2021-09-22)

Fixes and Improvements

  • Bump version of libpact_ffi to 0.0.2 (490249c)
  • Verifier now accepts explicitly setting options to undefined (it will ignore and warn). This fixes a regression introduced in beta-45 (7521c61)

13.1.6 (2021-09-14)

Fixes and Improvements

  • verifier: Correct the way that authentication tokens are sent to the verifier (4902db7)

13.1.5 (2021-09-09)

Fixes and Improvements

  • add disableSslVerification option to verifier (f354d8a)
  • update standalone to 1.88.66 (#320) (92f0532)

13.1.4 (2021-09-08)

Fixes and Improvements

  • Fix an issue that caused ENOENT on some platforms (943484a)
  • update standalone to 1.88.65 (#319) (3be38b4)

13.1.3 (2021-09-06)

Fixes and Improvements

  • Add consumer version selectors for deployedOrReleased, deployed, released and environment (#715) (1bf3b22)

13.1.2 (2021-09-06)

Fixes and Improvements

  • Don't create logger on each log call, so that frameworks that check for imports after teardown (jest) don't throw errors deep inside pino (c5cf077)

13.1.1 (2021-09-06)

Fixes and Improvements

  • bump dependencies to fix a possible issue with a misbehaving pino (fe09e4e)

13.1.0 (2021-08-26)

Features

  • The new verifier now works on windows too (#316) (072e080)

Fixes and Improvements

  • correct ffi library name on windows (814ed9c)

13.0.1 (2021-08-24)

Fixes and Improvements

  • expose needle types as a dependency to fix TS (e8ad281)

13.0.0 (2021-08-24)

⚠ BREAKING CHANGES

  • setLogLevel no longer accepts or returns a number
  • The verbose option has been removed, as it is now implied by logLevel of DEBUG or TRACE
  • All logging and reporting is now on standard out. This was the default before. This means the logDir / format / out options are no longer supported. If your ecosystem needs the ability to customise logging and reporting, please let us know by opening an issue.
  • The undocumented option monkeypatch has been removed. The use cases for this feature are mostly covered by other options.
  • customProviderHeaders has been removed. Please see the request filter documentation in pact-js.

Features

  • include standalone binaries in released package (eedeb18)
  • Use the native ffi bindings for the Verifier instead of the ruby bindings (119c3ce)
  • Add migration docs and update readme (e589c01)
  • Refactor logger to make it easier to use ffi logs (c650192)

Fixes and Improvements

  • Correct exposed log levels to 'debug' | 'error' | 'info' | 'trace' | 'warn'. (4a6f573)
  • Expose logger as a base level export (5686a66)
  • Print warnings if 'latest' is used as a tag during verification (ddd516d)
  • Remove some unnecessary files from the npm package (60c4aa1)
  • Use the new pact_ffi instead of the verifier-only one (5d2f364)

11.1.1 (2021-08-11)

Fixes and Improvements

  • Avoid throwing an exception if needle can't connect to the mock service during polling (may fix #314) (74a2cde)
  • package.json & package-lock.json to reduce vulnerabilities (1a1439c)
  • package.json & package-lock.json to reduce vulnerabilities (44bd189)
  • update standalone to 1.88.63 (240ea6c)

11.1.0 (2021-08-02)

Features

  • improve m1 support (via rosetta2) (92bd98b)

Fixes and Improvements

  • Replace request with needle (b053e54)
  • update standalone to 1.88.58 (b95b6ae)
  • update standalone to 1.88.61 (019af87)

12.0.0-beta.0 (2021-06-28)

⚠ BREAKING CHANGES

  • The verbose option has been removed, as it is now implied by logLevel of DEBUG or TRACE
  • All logging and reporting is now on standard out. This was the default before. This means the logDir / format / out options are no longer supported. If your ecosystem needs the ability to customise logging and reporting, please let us know by opening an issue.
  • The undocumented option monkeypatch has been removed. The use cases for this feature are mostly covered by other options.
  • customProviderHeaders has been removed. Please see the request filter documentation in pact-js.

Features

  • Use the native ffi bindings for the Verifier instead of the ruby bindings (1aea16f)
  • Add migration docs and update readme (6bd0df0)

11.0.1 (2021-06-21)

Fixes and Improvements

  • Allow the user to specify the timeout (Fixes #298) (4c77ddb)
  • update standalone to 1.88.56 (81821fc)

11.0.0 (2021-05-21)

⚠ BREAKING CHANGES

  • All the interfaces that previously returned q.Promise have now been replaced with native es6 Promises. Calling code will need to be updated.
  • All options deprecated in previous versions have been removed. Migration instructions:

  • In VerifierOptions: replace use of tags, consumerVersionTag and providerVersionTag with the appropriate consumerVersionTags or providerVersionTags option.

  • The following classes have had their .create(options) removed. Please use the appropriate constructor instead (for example, new Verifier(options))

    • Verifier
    • Publisher
    • Server
    • Stub
  • docs: The type for consumer version selectors in the verifier has been corrected. This will affect typescript users who were using consumerVersionSelectors with the fields pacticipant, all or version. These fields never worked, and now will no longer compile in typescript. The correct type is:
ConsumerVersionSelector {
  tag?: string;
  latest?: boolean;
  consumer?: string;
  fallbackTag?: string;
}

Note that pacticipant, version and all have been removed. Existing code that uses pacticipant needs to use consumer instead. The other fields can be dropped. Any questions, please reach out to us at https://slack.pact.io/

Fixes and Improvements

  • ConsumerVersionSelector interface (b1e5afe)
  • Replace q ith native Promise (a5076cc)
  • The verifier option providerStatesSetupUrl is no longer deprecated. Other deprecated options have been removed. (95b88e0)
  • update standalone to 1.88.46 (e9f2b43)
  • update standalone to 1.88.47 (5626f3b)
  • update standalone to 1.88.48 (14e31cf)
  • update standalone to 1.88.49 (cb088ce)
  • update standalone to 1.88.50 (ce92950)
  • update standalone to 1.88.51 (de83a99)

10.12.2 (2021-04-20)

Fixes and Improvements

  • update standalone to 1.88.46 (e9f2b43)
  • update standalone to 1.88.47 (5626f3b)
  • update standalone to 1.88.48 (14e31cf)
  • update standalone to 1.88.49 (cb088ce)

10.12.1 (2021-03-31)

Fixes and Improvements

  • package.json & package-lock.json to reduce vulnerabilities (8d76550)
  • update standalone to 1.88.41 (3916c88)
  • update standalone to 1.88.45 (fcab9f8)

10.12.0 (2021-03-05)

Features

  • package-name: Pact-node renamed to pact-core (700ad09)

10.11.11 (2021-02-28)

Fixes and Improvements

  • update standalone to 1.88.40 (618fb9d)

10.11.10 (2021-02-25)

Fixes and Improvements

  • update standalone to 1.88.38 (de4aaf2)

10.11.9 (2021-02-24)

Fixes and Improvements

  • 🐛 only download binary if PACT_SKIP_BINARY_INSTALL is true (69cbba0)

10.11.8 (2021-02-09)

Fixes and Improvements

  • install: Use the current working directory instead of the installed directory when finding package.json (Fixes #234) (30c41dc)

10.11.7 (2021-02-02)

Fixes and Improvements

  • logger: Log output now correctly reads pact-node instead of pact (c9f22e1)
  • update standalone to 1.88.37 (383eb8a)

10.11.6 (2021-02-01)

Fixes and Improvements

  • types: Correctly export logger type (in the future we should use our own type) (a4f766f)

10.11.5 (2021-02-01)

Fixes and Improvements

  • update standalone to 1.88.36 (22e8414)
  • can-i-deploy: Can-i-deploy now prints a warning instead of failing if additional output is produced alongside the json (364afb2)
  • logger: Imply verbose mode when log level is debug or trace (814d4fb)
  • logger: Now pact-node and ruby use the same logLevel if specified (513a60d)
  • logging: Only log entire environment when log level is trace, not debug (c3b9f5f)

10.11.4 (2021-01-28)

Fixes and Improvements

  • update standalone to 1.88.35 (d8dfe39)

10.11.3 (2021-01-28)

Fixes and Improvements

  • update standalone to 1.88.34 (cba5625)

10.11.2 (2021-01-27)

Fixes and Improvements

  • message: Change the way pact-message is invoked which should avoid some issues in Windows environments (92185b0)
  • update standalone to 1.88.33 (d42e348)

10.11.1 (2021-01-04)

Bug Fixes

  • message: Fixed an issue where message pacts could not be created on some platforms (a092ed9)

10.11.0 (2020-10-22)

Features

  • install: Binary install can be skipped by setting PACT_SKIP_BINARY_INSTALL=true (4d6b194)

10.10.2 (2020-10-19)

Bug Fixes

  • Correct the config for using custom ca file (e83c895)
  • spelling in error message. (c40170d)
  • update standalone to 1.88.3 (6e1c80b)

10.10.1 (2020-08-26)

Bug Fixes

  • server: remove force-clone of options (1a7a6e0)

10.10.0 (2020-08-10)

Features

  • logging: Add logLevel to Stub options, and add logDir and logLevel to Verifier options (acc0579)

Bug Fixes

  • deps: Update vulnerable dependencies (239c7a7)
  • package.json & package-lock.json to reduce vulnerabilities (70aa0f0)
  • update standalone to 1.86.0 (524a7dd)

10.9.7 (2020-07-17)

Bug Fixes

  • deps: update package and package-lock to fix vulnerabilties (6566680)

10.9.6 (2020-06-29)

Bug Fixes

  • deps: Update vulnerable dependencies (d210c1b)

10.9.5 (2020-06-03)

Bug Fixes

  • update standalone to 1.85.0 (acb9aa9)

10.9.4 (2020-05-04)

Bug Fixes

  • options: Stop validating values for logLevel, pactFileWriteMode and format. This means we'll immediately pick up changes to those options without needing to modify pact-node (1319a86)

10.9.3 (2020-05-02)

Bug Fixes

  • update standalone to 1.84.0 (9f2eb16)

10.9.2 (2020-04-22)

Bug Fixes

  • update standalone to 1.83.0 (0cfefb4)

10.9.1 (2020-04-22)

Bug Fixes

  • consumerVersionSelector -> consumerVersionSelectors (dab9507)

10.9.0 (2020-04-10)

Bug Fixes

  • standalone: update standalone to 1.82.3 (#223) (70fac35)

Features

  • verifier: Add support for includeWipPactsSince (c691162)
  • deprecate consumerVersionTag and providerVersionTag. Fixes #218 (3e932bd)

10.8.1 (2020-04-08)

Bug Fixes

10.8.0 (2020-03-26)

Features

  • add consumer version selectors and pending pacts to verification (59ab437)

10.7.1 (2020-03-23)

Bug Fixes

  • standalone: Bump version of pact-standalone to 1.82.1 (improved json diff, basic auth config improvements) (bde0287)

10.7.0 (2020-03-23)

Bug Fixes

  • deps: Update vulnerable dependencies (3c20366)

Features

  • verifier: Add verbose option to improve debugging during verification (3f0a5a3)

10.6.0 (2020-03-15)

Bug Fixes

  • remove tests, point directly to npm config settings for ca and StrictSSL (ae36609)
  • set strictSSL on custom downloads from NPM config. Fixes #211 (d264f0b)

Features

  • upgrade: update standalone to 1.82.0 (92c3af3)

10.5.0 (2020-03-02)

Bug Fixes

  • lint errors (3786e13)
  • remove decompress dependency as it is highly vulnerable. Fixes #208 (6956544)
  • remove extracted binary folders on clean to avoid false positives (7e8f76b)
  • use unzipper for .zip files, tar for tar.gz (f6d8da0)

Features

  • upgrade: update standalone to 1.81.0 (21a1564)

10.4.0 (2020-02-18)

Features

  • upgrade: update standalone to 1.80.1 (1a2f517)

10.3.1 (2020-02-17)

Bug Fixes

10.3.0 (2020-02-14)

Features

  • add validation to broker token usage to avoid confusion (2a4afa3)
  • upgrade: update standalone to 1.79.0 (f33cbb8)

10.2.4 (2019-12-17)

Bug Fixes

  • standalone: Bump version of pact-standalone to 1.73.0; fixes #183 (41bafad)

10.2.3 (2019-12-11)

Bug Fixes

  • spawn: Improve debug log formatting (977a845)
  • spawn: Now binaries are spawned directly with array arguments, rather than quoted strings. Should fix #118 (378f256)

10.2.2 (2019-11-15)

10.2.1 (2019-11-10)

10.2.0 (2019-11-08)

Features

  • add provider version tag during verification (68b17d8)

10.1.0 (2019-11-08)

Features

  • add provider version tag during verification (68b17d8)

10.0.1 (2019-10-28)

Bug Fixes

  • install: Correctly skip downloading the binary archive if it already exists (1c9a809)
  • install: Fail installation if binary was not successfully downloaded (3dfb033)
  • spawn: The command used to spawn the binary is now debug rather than info (fixes #184) (a9f1470)

10.0.0 (2019-10-28)

Features

  • can-i-deploy: Add custom error type CannotDeployError for when the deploy check fails (635b449)
  • can-i-deploy: allow multiple pacticipants to be specified to CanDeploy (b4b3921)
  • canDeploy: resolve with output on success (d20744e)
  • CanDeploy: Set json output as the default for CanDeploy (200abe7)

BREAKING CHANGES

  • can-i-deploy: Options for CanDeploy have changed. Now, pacticipants are specified by an array of { name: <string>, latest?: <string | boolean>, version?: <string> }, allowing more than one pacticipant to be specified. You must specify one of latest or version. If latest is true, the latest pact is used. If it is string, then the latest pact with that tag is used.
  • CanDeploy: CanDeploy now defaults to json output (and returns the parsed object as the result of the promise. If you were using CanDeploy and relied on parsing the logged output, you will need to explicitly set output: table in your CanDeploy options.

9.0.7 (2019-10-23)

Bug Fixes

  • package.json: Move snyk to devDependencies (#193) (b3d7a8a)

9.0.6 (2019-10-10)

Bug Fixes

  • verifier: allow to use progress formatter during verification (#189) (2571725)
  • package.json, package-lock.json & .snyk to reduce vulnerabilities (0dc7a8f)

9.0.5 (2019-10-08)

Bug Fixes

  • upgrade vulnerable dependencies (e79f929)

9.0.4 (2019-09-11)

Bug Fixes

  • logging: print options in json instead of using a helper (9f09348)

9.0.3 (2019-09-05)

Bug Fixes

  • Upgrade pact-standalone version to v1.70.2 (3f0f1fc)

9.0.2 (2019-08-06)

Bug Fixes

  • Correct typo in verifier options mapping (810bd77)
  • logging: Print args for spawn binary correctly in debug output (2b0ce9d)

9.0.1 (2019-08-05)

Bug Fixes

  • server: Maintain a private reference to the global setTimeout function in case that function is mocked in a consumer test (e.g. sinon.useFakeTimers()) (#110) (f4ebfff)

9.0.0 (2019-07-16)

Bug Fixes

  • .snyk, package.json & package-lock.json to reduce vulnerabilities (31e34a1)
  • prevent archive extracting as the wrong user when installling as root (d0941b0)

Features

  • introduce pact binary, and remove pact-cli (BREAKING CHANGE) (884ce24)

8.6.2 (2019-07-03)

Bug Fixes

8.6.1 (2019-06-28)

Bug Fixes

8.6.0 (2019-06-18)

Features

  • verifier: update to latest verifier (9f328db)

8.5.1 (2019-06-15)

Bug Fixes

  • verifier: --monkeypatch flag missing (b1355bd)

8.5.0 (2019-06-12)

Features

  • verifier: update to latest verifier (da3d1e3)

8.4.1 (2019-06-06)

Bug Fixes

  • cli: propagate exit code in node CLI wrapper (b961b79)

8.4.0 (2019-05-30)

Bug Fixes

  • mock: fix q resolver in integration mocks (6de02db)

Features

  • binstubs: expose pact standalone binaries as alternative CLI (02f16cc)
  • binstubs: expose pact standalone binaries as alternative CLI (5c164da)

8.3.3 (2019-05-22)

8.3.2 (2019-05-19)

8.3.1 (2019-05-16)

Bug Fixes

  • Upgrade Caporal to fix vulnerability (Fixes #159) (6efa434)

8.3.0 (2019-05-13)

Features

  • can-deploy: add broker token to can-deploy task (#158) (fad1e63)

8.2.0 (2019-04-26)

Features

  • verifier: update to latest verifier (8637cae)

8.1.2 (2019-04-11)

Bug Fixes

  • package.json to reduce vulnerabilities (#151) (181e5d8)

8.1.1 (2019-03-28)

Bug Fixes

  • specify User-Agent when downloading binaries (a2a1698), closes #149

8.1.0 (2019-03-08)

Features

  • publish: add bearer token to publish (3a411b4)

8.0.0 (2019-03-07)

Features

  • verifier: update to latest verifier (888209b)
  • verify: support broker bearer token (f060b78)

BREAKING CHANGES

  • verifier: removal of Broker class

7.0.1 (2019-03-06)

Bug Fixes

7.0.0 (2019-03-04)

Bug Fixes

  • can-i-deploy: Fixing can-i-deploy to only have a single participant at a time, but breaking API. New major release. (#144) (2032ba2)

6.21.5 (2019-02-26)

6.21.4 (2019-02-09)

6.19.11 (2018-08-21)

6.19.10 (2018-08-13)

6.19.8 (2018-07-28)

6.19.6 (2018-07-13)

6.19.5 (2018-07-13)

Bug Fixes

  • binary-location: Fixing failing tests on windows because the path.resolve would add 'C:' to the front of the path, failing the expectation (40f4d6d)

6.16.4 (2018-05-10)

6.16.1 (2018-05-08)

6.14.3 (2018-04-17)

Bug Fixes

  • verifier: update error message if pactUrls not specified. Fixes #78 (1e7bfda)

6.14.2 (2018-04-05)

6.14.1 (2018-04-04)

6.14.0 (2018-03-30)

Features

  • message: add spec version to message type (7839a12)

6.13.0 (2018-03-27)

Features

  • messages: add Message Pact support (980a3f5)

6.10.0 (2018-02-22)

Features

  • upgrade: upgrade pact standalone to 3.7.0 (3b59836)

6.9.0 (2018-02-20)

Features

  • upgrade: upgrade pact standalone to 3.6.0 (0aa6f8f)

6.8.0 (2018-02-09)

Features

  • upgrade: upgrade pact standalone to 3.5.0 (82928f1)

6.6.0 (2017-12-13)

Features

  • api: add removeAll() interface to main API (9306183)
  • stub: add basic stub support (62185b5)

6.5.0 (2017-12-10)

Features

  • pactFileWriteMode: add pactFileWriteMode to server. Fixes #50 (0f8658b)

6.4.1 (2017-12-08)

6.4.0 (2017-12-08)

Features

  • upgrade: upgrade pact standalone to 3.4.0 (a77f9f7)

6.3.0 (2017-12-04)

Features

  • custom-headers: allow user to specify custom headers during provider verification (3797193)

6.2.0 (2017-12-04)

Features

  • types: re-export out common types for library use (fa19b57)

6.1.0 (2017-12-03)

Bug Fixes

  • lint: add noImplicitThis to TS configuration (eb17979)
  • lint: fix noImplicitReturns TS issues (5c57288)

Features

  • types: add support for TS 'strictNullChecks' (76d8c38)
  • types: feedback from mboudreau (e756592)
  • types: uplift code base to comply with noImplicitAny (861ae89)

Change Log

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.