pact-foundation / pact-stub-server

Standalone pact stub server
MIT License
75 stars 19 forks source link

Feature request: Live update stubs #52

Open jamesarosen opened 1 year ago

jamesarosen commented 1 year ago

Problem

If I run the server as follows:

pact-stub:
  command:
    - "-p3001"
    - "-dpacts"
  container_name: my-pact-stub
  image: pactfoundation/pact-stub-server
  ports:
    - "3001:3001"
  tty: true
  volumes:
    - "./test/pacts/:/app/pacts:ro"

and then change one of the files in test/pacts/ (either manually or by running my unit tests), the change is not reflected in subsequent requests to the server without restarting it.

Why this matters

Following the Writing Consumer Tests guide, our process is:

  1. write some Unit tests using Pact
  2. run the tests; Pact generates test/pacts/… files
  3. run Acceptance tests using Cypress and the pact-stub-server

I'd like to keep Cypress, the pact-stub-server, and the unit-test suite all running in the background so I can develop continuously. As it is, I need to restart the Docker containers after every change.

Possible Solutions

jamesarosen commented 1 year ago

Another use-case: it would be nice to start the pact-stub-server in a GitHub Action using services, but that will start it before I have a chance to run unit tests and output pact files.

mstaudt commented 1 year ago

+1, would be very helpful :)

neokree commented 1 year ago

+1