Skip to content

Commit cf10aa6

Browse files
committed
fix: allow test within pact.Verify() to fail build
pact.Verify(integrationTest) currently only fails if the pact verification fails, but integration tests within it may also do so. Fixes #37
1 parent 5a6855a commit cf10aa6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ Read more about [flexible matching](https://github.com/realestate-com-au/pact/wi
249249
]
250250
]`)
251251
})
252-
go http.ListenAndServe(":8000"), mux)
252+
go http.ListenAndServe(":8000", mux)
253253
```
254254

255255
Note that the server has 2 endpoints: `/states` and `/setup` that allows the

Diff for: dsl/pact.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,13 @@ func (p *Pact) Verify(integrationTest func() error) error {
179179
}
180180

181181
// Run the integration test
182-
integrationTest()
182+
err := integrationTest()
183+
if err != nil {
184+
return err
185+
}
183186

184187
// Run Verification Process
185-
err := mockServer.Verify()
188+
err = mockServer.Verify()
186189
if err != nil {
187190
return err
188191
}

0 commit comments

Comments
 (0)