{"id":16323488,"url":"https://github.com/you54f/template-jest-pact-typescript","last_synced_at":"2026-03-17T14:55:06.996Z","repository":{"id":37050640,"uuid":"162180383","full_name":"YOU54F/template-jest-pact-typescript","owner":"YOU54F","description":"A Pact consumer example written in TypeScript with Jest","archived":false,"fork":false,"pushed_at":"2023-05-17T21:24:21.000Z","size":1491,"stargazers_count":36,"open_issues_count":0,"forks_count":10,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-16T23:54:07.003Z","etag":null,"topics":["mock-server","pact-consumer","pact-contract","pact-stub-server","pact-tests","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YOU54F.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-17T19:34:12.000Z","updated_at":"2025-02-24T07:09:21.000Z","dependencies_parsed_at":"2024-10-28T09:08:14.586Z","dependency_job_id":"55c09a6d-5a1f-4222-ac0a-a6afb2f7e0f9","html_url":"https://github.com/YOU54F/template-jest-pact-typescript","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/YOU54F/template-jest-pact-typescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YOU54F%2Ftemplate-jest-pact-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YOU54F%2Ftemplate-jest-pact-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YOU54F%2Ftemplate-jest-pact-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YOU54F%2Ftemplate-jest-pact-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YOU54F","download_url":"https://codeload.github.com/YOU54F/template-jest-pact-typescript/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YOU54F%2Ftemplate-jest-pact-typescript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30626596,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T14:16:03.965Z","status":"ssl_error","status_checked_at":"2026-03-17T14:16:03.380Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mock-server","pact-consumer","pact-contract","pact-stub-server","pact-tests","typescript"],"created_at":"2024-10-10T22:54:57.106Z","updated_at":"2026-03-17T14:55:04.969Z","avatar_url":"https://github.com/YOU54F.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pact Consumer Workflow Example in Typescript with Jest\n\n[![CircleCI](https://circleci.com/gh/YOU54F/template-jest-pact-typescript.svg?style=svg)](https://circleci.com/gh/YOU54F/template-jest-pact-typescript)\n\n## Showcases the following\n\n- [x] Written in Typescript\n- [x] Utilises Pact in a Jest Wrapper [jest-pact](https://github.com/YOU54F/jest-pact)\n- [x] Uses Swagger to define API\n- [x] Uses Swagger-cli to validate Swagger specification\n- [x] Uses Pact.io to perform consumer driven contract tests\n- [x] Uses Swagger-mock-validator to validate generated pact contracts\n- [x] Publishes validated pact contracts to pact-broker (hosted on AWS EC2)\n- [x] Pact mock service docker base\n- [x] Pact mock service docker base examples\n- [x] circleci config\n- [x] use pmpact to generate postman collections for pact contracts\n- [x] Example pact tests\n  - [x] AWS v4 Signed API Gateway Provider\n  - [x] Soap API provider\n  - [x] File upload API provider\n  - [x] JSON API provider\n- [x] Pact mock service docker base\n- [x] Pact mock service docker base examples\n- [x] Postman integration\n  - [x] Generate postman collections from pact contracts\n  - [x] Inject URL into postman collection from `PACT_PROVIDER_URL`\n  - [x] Run postman scripts with newman\n  - [x] Run postman scripts with jest\n- [ ] example can-i-deploy\n\n## Where can I see it\n\n- CircleCI builds here - \u003chttps://circleci.com/gh/YOU54F/pact-consumer-example-typescript\u003e\n- Pact Broker here - \u003chttps://you54f.co.uk\u003e - running on AWS Lambda (see \u003chttps://github.com/YOU54F/pact_broker-serverless\u003e for details of setup)\n\n## Installation\n\n- clone repository\n- Run `yarn install`\n\n### Run pact tests\n\n- Run `yarn run pact-test`\n\n### Validate Swagger spec\n\n- Run `yarn run swagger-validate-spec`\n\n### Validate Pact contract against Swagger spec\n\n- Run `yarn run swagger-validate-pact`\n\n### Publish pacts\n\n- Run `yarn run pact-publish`\n\n### Start the mock server\n\n- Run `cd docker \u0026\u0026 docker-compose up`\n\n### Set the following env vars for pact publishing\n\n- PACT_BROKER_BASE_URL\n- PACT_BROKER_TOKEN\n\n### Create postman collections from pacts\n\n- run `./postman/postman-pact.sh` to generate postman collections in `pact/postman/collections`\n- run `./postman/postman-replace-urls.sh` to generate env configs for postman in `pact/postman/env` where the urls are replaced with `$PACT_PROVIDER_URL`\n- run `./postman/postman-newman.sh` to run the postman collection against your `$PACT_PROVIDER_URL`\n- run newman tests with jest, via `npx jest -c jest.newman.js`\n\nNote:- There are no tests in the saved postman collections, so it will run the requests, but will not validate the responses are as per the pacts.\n\nTODO\n\n- [ ] Currently this will use `$PACT_PROVIDER_URL` for all generated postman collections, add the ability to specify a provider name, and update the url accordingly.\n\n## Build your own Pact Stub Service for your pacts in Docker\n\n`cd docker/pact-stub-service`\n\nBuild the base pact image, change the name `you54f` to your own dockerhub username\n\nThe Base image resides at `base.Dockerfile` which will load the pact ruby standalone, plus a healthcheck endpoint `/healthcheck` on the containers for use in AWS and other Cloud providers.\n\n`make pact_build`\ndocker build -t pact-base -f base.Dockerfile .\n`make pact_tag`\ndocker tag pact-base you54f/pact-base\n`make pact_push`\ndocker push you54f/pact-base\n\nYou can then copy your pact files generated with `yarn run test` into the `docker/pact-stub-service/pacts` folder that the `Dockerfile` will use.\n\n`copy_pacts`\nrm -rf pacts \u0026\u0026 cp -r ../../pact/pacts .\n\nLook at the `Dockerfile`\n\n```Dockerfile\nFROM you54f/pact-base\n\nARG PACT_FILE\n\nCOPY ${PACT_FILE} /pact.json\n```\n\nSee the `docker/docker-compose.yml` file for how to load your pacts into the docker container.\n\n```yaml\nversion: \"3.1\"\n\nservices:\n  pact-stub-server-json:\n    build:\n      context: pact-stub-service\n      args:\n        PACT_FILE: pacts/test-consumer-json-provider.json\n    ports:\n      - \"8080:8080\"\n```\n\nYou can run it with `cd docker \u0026\u0026 docker-compose up`\n\n## Credits\n\n- [Pact Foundation](https://github.com/pact-foundation)\n- [Pact JS](https://github.com/pact-foundation/pact-js)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyou54f%2Ftemplate-jest-pact-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyou54f%2Ftemplate-jest-pact-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyou54f%2Ftemplate-jest-pact-typescript/lists"}