pact-foundation / jest-pact

A Pact adaptor for to allow you to easily run tests with Jest
https://pact.io
MIT License
81 stars 12 forks source link

Pact js v3+master merge #214

Closed YOU54F closed 2 years ago

YOU54F commented 2 years ago

Merging v3 into master branch, incorporates the v2/v3 api's.

WIP - see comment

YOU54F commented 2 years ago

Some errors

  1. Typescript import for express - https://github.com/pact-foundation/jest-pact/runs/7671101190?check_suite_focus=true#step:4:331 - potential fix by https://github.com/pact-foundation/pact-js/pull/906
  2. Typescript import for dsl/mockService - https://github.com/pact-foundation/jest-pact/runs/7671101190?check_suite_focus=true#step:4:332 / fixed by https://github.com/pact-foundation/pact-js/pull/905 (needs release)
  3. Error when calling mockService.verify() - https://github.com/pact-foundation/jest-pact/runs/7671646428?check_suite_focus=true#step:4:357

For 3, the error states

TypeError: clc.red is not a function

Pact-js uses https://www.npmjs.com/package/cli-color as a dependency, and has 3rd party types provided https://www.npmjs.com/package/@types/cli-color

cli-color was recently updated by synk in a big bump (1.0.1 > 2.0.1) and the types were not updated.

Updating the import import clc from 'cli-color'; from import * as clc from 'cli-color'; and pulling that compiled build into jest-pact appears to fix the issue and I can see the verification results

Screenshot 2022-08-04 at 13 43 51