Skip to content

Commit d139eec

Browse files
committed
updated angular-pact example
1 parent 671f5e5 commit d139eec

File tree

5 files changed

+42
-30
lines changed

5 files changed

+42
-30
lines changed

pact-angular/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,13 @@ a consumer against the Pact.
1818
Run `npm install` to load the needed javascript libraries and then `npm run test` to
1919
run the tests. After the tests have successfully run the created pact file will be
2020
created in the folder `pacts`.
21+
22+
Then, you can call `npm run publish-pacts` to publish the pact files to a [Pact Broker](https://github.com/pact-foundation/pact_broker).
23+
You must set the following npm configs for the `publish-pacts` script to work:
24+
25+
```
26+
npm config set angular-pact:brokerUrl <URL>
27+
npm config set angular-pact:brokerUsername <USER>
28+
npm config set angular-pact:brokerPassword <PASS>
29+
30+
```

pact-angular/package-lock.json

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pact-angular/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
"ts-node": "~3.2.0",
4747
"tslint": "~5.7.0",
4848
"typescript": "~2.3.3",
49-
"@pact-foundation/pact-node": "^5.1.2",
50-
"@pact-foundation/karma-pact": "~2.1.0",
51-
"pact-web": "~3.0",
49+
"@pact-foundation/pact-node": "6.5.0",
50+
"@pact-foundation/karma-pact": "2.1.3",
51+
"pact-web": "4.3.1",
5252
"cross-env": "^5.0.5"
5353
}
5454
}

pact-angular/publish-pacts.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
let projectFolder = __dirname;
22
let pact = require('@pact-foundation/pact-node');
33
let project = require('./package.json');
4+
let pactBrokerUrl = process.env.npm_package_config_brokerUrl;
5+
let pactBrokerUsername = process.env.npm_package_config_brokerUsername;
6+
let pactBrokerPassword = process.env.npm_package_config_brokerPassword;
47

58
let options = {
6-
pactUrls: [projectFolder + '/pacts'],
7-
pactBroker: 'https://adesso.pact.dius.com.au/',
9+
pactFilesOrDirs: [projectFolder + '/pacts'],
10+
pactBroker: pactBrokerUrl,
811
consumerVersion: project.version,
912
tags: ['latest'],
10-
pactBrokerUsername: 'Vm6YWrQURJ1T7mDIRiKwfexCAc4HbU',
11-
pactBrokerPassword: 'aLerJwBhpEcN0Wm88Wgvs45AR9dXpc'
13+
pactBrokerUsername: pactBrokerUsername,
14+
pactBrokerPassword: pactBrokerPassword
1215
};
1316

17+
1418
pact.publishPacts(options).then(function () {
1519
console.log("Pacts successfully published!");
1620
});

pact-angular/src/app/user.service.pact.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ describe('UserService', () => {
1212
provider = Pact({
1313
consumer: 'ui',
1414
provider: 'userservice',
15-
web: true,
1615
port: 1234,
1716
host: '127.0.0.1',
18-
logLevel: 'DEBUG'
1917
});
2018

2119
// required for slower CI environments

0 commit comments

Comments
 (0)