- In the pact-js project root, change to the
examples/jest
directory - Run:
npm i
- Run the tests:
npm t
To avoid race conditions if you have multiple pact specs, we recommend running Jest 'in band'. If you are running a large unit test suite you may want to run that separately as a result to take advantage of the concurrency of jest (although this is not always faster). To achieve this you can get your pact tests to have a suffix of '.pact.js' and add the following Jest argument to your pact task in npm:
--testRegex \"/*(.test.pact.js)\""
This example uses jest-pact