Getting additional reports #1246
Replies: 1 comment
|
If you only need the Pact JS verifier output written to a file, current Pact JS supports const { Verifier } = require('@pact-foundation/pact')
await new Verifier({
providerBaseUrl: 'http://localhost:8080',
pactUrls: [
'./pacts/consumer-a-provider.json',
'./pacts/consumer-b-provider.json'
],
logFile: './reports/pact-verification.log'
}).verifyProvider()That is a log file, though, not a structured test report. For JSON/JUnit/HTML reporting, the current supported option is the standalone Pact verifier CLI. You can make it available to a Node project with: npm install --save-dev @pact-foundation/pact-cliThen verify all contracts in one run: npx pact verifier \
--dir ./pacts \
--hostname localhost \
--port 8080 \
--json ./reports/pact-verification.json \
--junit ./reports/pact-verification.xml \
--html ./reports/pact-verification.html
For example: npx pact verifier \
--file ./pacts/consumer-a-provider.json \
--file ./pacts/consumer-b-provider.json \
--json ./reports/all-pacts.jsonIf the pacts come from a Pact Broker, one verifier invocation can also retrieve and verify all selected consumer contracts for the provider. One limitation: if your current Pact JS setup relies on JavaScript So the current distinction is:
Please mark this answer as accepted if it helped, thank you. |
Uh oh!
There was an error while loading. Please reload this page.
Hi,
How do I get additional reports apart from the one logged in the console ?
Also, I run multiple contracts verifications, can I configure tests to receive a consolidated report ?
All reactions