Karma Pact

Implementation of a Karma Plugin to launch a Pact Mock Server before executing your Pact tests on the browser.
From the Pact website:
The Pact family of frameworks provide support for Consumer Driven Contracts testing.
A Contract is a collection of agreements between a client (Consumer) and an API (Provider) that describes the interactions that can take place between them.
Consumer Driven Contracts is a pattern that drives the development of the Provider from its Consumers point of view.
Pact is a testing tool that guarantees those Contracts are satisfied.
Read Getting started with Pact for more information on
how to get going.
Installation
First install the package from NPM:
npm install --save-dev karma-pact
Then, on your Karma Configuration file, add the below:
module.exports = function (config) {
config.set({
frameworks: ['jasmine', 'pact'],
pact: {}
})
The pact
configuration in the file is as follows (same present at pact-node):
{
port: <Number>,
host: <String>,
log: <String>,
ssl: <Boolean>,
cors: <Boolean>,
dir: <String>,
spec: <Number>,
consumer: <String>,
provider: <String>
}
Examples
Check the karma
folder under Pact JS for examples with Mocha and Jasmine.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
If you would like to implement Pact
in another language, please check out the Pact specification and have a chat to one of us on the pact-dev Google group.
The vision is to have a compatible Pact
implementation in all the commonly used languages, your help would be greatly appreciated!
Contact