Pact-js migration guide
February 12, 2026 ยท View on GitHub
15.x.x -> 16.x.x
See the 15.x.x -> 16.x.x migration guide.
12.x.x -> 13.x.x
Breaking Changes
All CLI/API functionality provided by the Pact CLI tools (ruby based) now migrated to
-
Repo
-
NPM Package
-
imports
@pact-foundation/pact-coreimports will now become@pact-foundation/pact-clifor programmatic usage of the CLI tools
-
npx usage
npx --package=@pact-foundation/pact-cli@15.0.0 -c pact-broker
11.x.x -> 12.x.x
- Node versions less than 16 are no longer supported
- Pact FFI library is now prebuilt and included in the distributable dropping the requirement for a node-gyp build chain. Users can now use
--ignore-scripts- If errors are seen finding the native library, please
- run with
LOG_LEVEL=debug - follow the instructions provided
- run with
- If errors are seen finding the native library, please
10.x.x -> 11.x.x
There is just one single breaking change in this release. A conflicting type StateHandlers has been renamed to MessageStateHandlers for use in message pact tests.
9.x.x -> 10.x.x
See the 9.x.x -> 10.x.x migration guide.
For changes on the intermediate beta versions, see below:
10.0.0-beta.62
Removed the default export for v3 in the root package in preparation for a release.
10.0.0-beta.61
- new
addInteractionmethod on PactV3 to support previous JSON-style interactions - remove
VerifierV3as many beta versions have passed with this deprecation notice and won't be in final release - remove
json()method from consumer message pact - add new
WithBinaryContentmethod for consumer messages - add binary content support to messages via
WithBinaryContent - add text content support to messages via
WithTextContent - Remove all Ruby dependencies in DSLs
pactfileWriteModestill supports the same options, however the behaviour ofoverwriteis such now that it will overwrite the pact file per test, not pact run of Pact. This is because there is no longer a single long running mock server as per previous versions. Set tomergeor leave blank for a sensible default.- As per the change to
pactfileWriteModethis also means pact files should be cleared out prior to each test, to avoid extraneous interactions in a pact file. - Array matcher currently doesn't work on query strings (see https://github.com/pact-foundation/pact-reference/issues/205). However, an array with matchers is supported (see jest spec)
- the
mockServiceproperty on thePactclass is no longer an actualMockService, but supports thebaseUrlproperty. - Manually controlling the state of the mock server - such as removing interactions - has been removed.
10.0.0-beta.56
Migrates to a new handle based verifier. This adds several layers of improvement, including better error handling/response output (which will be added in later versions).
- Drop support for migrating
disableSSLVerification(correct field is**disableSslVerification**) - Handle based verifier doesn't support environment variables (i.e.
PACT_BROKER_*)
This guide is for migrating to a new version of pact-js.
10.0.0-beta.52
The following matchers now must have an explicit example provided:
datetimetimestamptime
10.0.0-beta.47
Change uses of RFC3339_TIMESTAMP_FORMAT or Matchers.rfc1123Timestamp() to
RFC1123_TIMESTAMP_FORMAT and rfc1123Timestamp respectively (this matcher
has always been RFC1123, not RFC3339).
10.0.0-beta.44 to beta.45
You no longer need to use VerifierV3. You may now do:
import { Verifier } from '@pact-foundation/pact'
If migrating from VerifierV3, note that disableSSLVerification has been
renamed disableSslVerification for consistency with other options.
The VerifierV3 still exists with the old options, it now delegates to the main verifier.
Verifier Options
There are several changes to the VerifierOptions. To migrate:
- Replace
verbosewithlogLevel: "DEBUG"(logLevels ofDEBUGand below now implyverbosewhere appropriate) - Replace
consumerVersionTagwith theconsumerVersionTagsarray - Replace
providerVersionTagwith theproviderVersionTagsarray - Replace
tagswithconsumerVersionTagsorproviderVersionTagsas appropriate.
Some options have been removed entirely:
customProviderHeadershas been removed. If you need this functionality, set an appropriate request filter with therequestFiltersoption instead.- All logging and reporting is now on standard out (this was the default before).
This means
logDir/format/outhave all been removed. If your ecosystem needs the ability to customise logging and reporting, please let us know by opening an issue. - The undocumented option
monkeypatchhas been removed. The use cases for this feature are mostly covered by other options.