You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-7Lines changed: 12 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,14 +12,17 @@
12
12
13
13
### Features
14
14
15
-
-[x] instantiates the PactOptions for you
15
+
-[x] instantiates the PactV2Options/PactV3Options for you
16
16
-[x] Setups Pact mock service before and after hooks so you don’t have to
17
17
-[x] Set Jest timeout to 30 seconds preventing brittle tests in slow environments like Docker
18
18
-[x] Sensible defaults for the pact options that make sense with Jest
19
19
-[x] Supports both the main release of pact-js (9.x.x) and the beta 10.x.x for Pact spec V3
20
20
21
21
## `Jest-Pact` Roadmap
22
22
23
+
-[ ] Add PactV4 interface with `JestProvidedPactFnV4`
24
+
-[ ] BREAKING CHANGE: make `JestProvidedPactFn` default to `JestProvidedPactFnV4`
25
+
-[ ] BREAKING CHANGE: rename `JestProvidedPactFn` to `JestProvidedPactFnV2`
23
26
-[ ] Ensure that jest-pact plays well with jest's default of watch-mode (This has been mothballed, please see this [draft pr](https://github.com/pact-foundation/jest-pact/pull/53) for details. Contributions welcome!
24
27
-[ ] Ensure that pact failures print nice diffs (at the moment you have to go digging in the log files)
25
28
-[ ] Add a setup hook for clearing out log and pact files
@@ -232,14 +235,16 @@ Jest-Pact has two primary functions:
232
235
233
236
Additionally, `pactWith.only/ fpactWith`, `pactWith.skip/ xpactWith`, `messagePactWith.only/ fmessagePactWith` and `messagePactWith.skip/ xmessagePactWith` behave as you would expect from Jest.
234
237
235
-
There are two types exported:
238
+
There are two types exported (depending on whether you are using the V2 or V3 Pact interface):
236
239
237
-
- `JestProvidedPactFn`: This is the type of the second argument to `pactWith`, ie: `(provider:Pact) =>void`
238
-
- `JestPactOptions`: An extended version of `PactOptions` that has some additional convienience options (see below).
240
+
- `JestProvidedPactFn`: This is the type of the second argument to `pactWith`, ie: `(provider:PactV2) =>void`
241
+
- `JestPactOptions`: An extended version of `PactV2Options` that has some additional convenience options (see below).
242
+
- `JestProvidedPactFnV3`: This is the type of the second argument to `pactWith`, ie: `(provider:PactV3) =>void`
243
+
- `JestPactOptionsV3`: An extended version of `PactV3Options` that has some additional convenience options (see below).
239
244
240
245
## Configuration
241
246
242
-
You can use all the usual `PactOptions` from pact-js, plus a timeout for
247
+
You can use all the usual `PactV2Options`/`PactV3Options` from pact-js, plus a timeout for
243
248
telling jest to wait a bit longer for pact to start and run.
244
249
245
250
```ts
@@ -257,14 +262,14 @@ interface ExtraOptions {
257
262
logFileName?: string; // filename for the log file
258
263
}
259
264
260
-
type JestPactOptions =PactOptions& ExtraOptions;
265
+
type JestPactOptions =PactV2Options& ExtraOptions;
261
266
262
267
type JestMessageConsumerOptions = MessageConsumerOptions & ExtraOptions;
263
268
```
264
269
265
270
### Defaults
266
271
267
-
Jest-Pact sets some helpful default PactOptions for you. You can override any of these by explicitly setting corresponding option. Here are the defaults:
272
+
Jest-Pact sets some helpful default `PactV2Options`/`PactV3Options` for you. You can override any of these by explicitly setting corresponding option. Here are the defaults:
268
273
269
274
- `log` is set so that log files are written to `/pact/logs`, and named `<consumer>-<provider>-mockserver-interaction.log`. If you provided an explicit `port`, then the log file name is `<consumer>-<provider>-mockserver-interaction-port-<portNumber>.log`
270
275
- `dir` is set so that pact files are written to `/pact/pacts`
0 commit comments