-
-
Notifications
You must be signed in to change notification settings - Fork 604
Proposal: integrate MSW with Pact (pact.io) #572
Description
Is your feature request related to a problem? Please describe.
Mocking APIs makes is preferable to end-to-end integration testing, because mocking enables:
- Fast feedback
- Requires fewer dependencies
- Does not need a dedicated test environment
- Reliable (not flakey) tests
- Simple debugging
You create sets of unit tests on either side of a boundary:
The problem with mocking APIs, is that you don't have confidence that your mocks are genuine representations of reality, and can lead to integration issues elsewhere (e.g. in production):
Describe the solution you'd like
Pact is a tool that uses a process known as consumer-driven contract-testing to capture the expectations from the API consumer, and replay them against the API provider to ensure these mocks are kept in sync. By using MSW as the capture mechanism (replacing the existing consumer test process) and serialising them into a Pact compatible contract (as defined by the Pact specification), we could use MSW with confidence knowing the mocks don't drift from reality.
Describe alternatives you've considered
n/a
Additional context
As discussed at the recent TestJS Summit
Opening up for conversation here.


