we currently try to establish pact in our angular frontend. as a test framework we use jest, so we use the library jest-pact for it.
As we use Pact V4 and V3 in the backend system using pact-jvm, we wanted to use it here as well.
The services actually calling our backend are generated from our openapi-spec.
Unfortunately we always get the following error:
FAIL src/app/pacts/foo.spec.pact.ts (6.818 s)
Pacts
Pact between frontend and backend
with 30000 ms timeout for Pact
test-foo
✕ foo (5010 ms)
● Pacts › Pact between frontend and backend › with 30000 ms timeout for Pact › test-foo › foo
thrown: "Exceeded timeout of 5000 ms for a test.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
24 | });
25 |
> 26 | execute('foo', ({ url }) => {
| ^
27 | const spectator = createHttp();
28 | spectator.service.configuration.basePath = url;
29 | return spectator.service
at context.<computed> (node_modules/zone.js/bundles/zone-testing.umd.js:492:43)
at execute (node_modules/jest-pact/src/v3/index.ts:41:9)
at src/app/pacts/foo.spec.pact.ts:26:7
at node_modules/jest-pact/src/v3/index.ts:43:7
at _ZoneDelegate.invoke (node_modules/zone.js/bundles/zone.umd.js:412:32)
at ZoneImpl.run (node_modules/zone.js/bundles/zone.umd.js:147:47)
at node_modules/zone.js/bundles/zone-testing.umd.js:426:37
at context.<computed> (node_modules/zone.js/bundles/zone-testing.umd.js:474:43)
at pactDescribe (node_modules/jest-pact/src/v3/index.ts:38:5)
at src/app/pacts/foo.spec.pact.ts:12:5
at node_modules/jest-pact/src/v3/index.ts:78:5
at _ZoneDelegate.invoke (node_modules/zone.js/bundles/zone.umd.js:412:32)
at ZoneImpl.run (node_modules/zone.js/bundles/zone.umd.js:147:47)
at node_modules/zone.js/bundles/zone-testing.umd.js:426:37
at context.<computed> (node_modules/zone.js/bundles/zone-testing.umd.js:474:43)
at jestPactWrapper (node_modules/jest-pact/src/v3/index.ts:55:3)
at node_modules/jest-pact/src/v3/index.ts:89:43
at _ZoneDelegate.invoke (node_modules/zone.js/bundles/zone.umd.js:412:32)
at ZoneImpl.run (node_modules/zone.js/bundles/zone.umd.js:147:47)
at node_modules/zone.js/bundles/zone-testing.umd.js:426:37
at context.<computed> (node_modules/zone.js/bundles/zone-testing.umd.js:474:43)
at pactWith (node_modules/jest-pact/src/v3/index.ts:89:3)
at src/app/pacts/foo.spec.pact.ts:11:11
at _ZoneDelegate.invoke (node_modules/zone.js/bundles/zone.umd.js:412:32)
at ZoneImpl.run (node_modules/zone.js/bundles/zone.umd.js:147:47)
at node_modules/zone.js/bundles/zone-testing.umd.js:426:37
at context.<computed> (node_modules/zone.js/bundles/zone-testing.umd.js:474:43)
at Object.<anonymous> (src/app/pacts/foo.spec.pact.ts:6:1)
● Pacts › Pact between frontend and backend › with 30000 ms timeout for Pact › test-foo › foo
Expected no open requests, found 1: GET http://127.0.0.1:62915/foo
at _HttpClientTestingBackend.verify (node_modules/@angular/common/fesm2022/http/testing.mjs:298:19)
at node_modules/@ngneat/spectator/fesm2022/ngneat-spectator.mjs:2347:51
at _ZoneDelegate.invoke (node_modules/zone.js/bundles/zone.umd.js:412:32)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/bundles/zone-testing.umd.js:2164:43)
at _ZoneDelegate.invoke (node_modules/zone.js/bundles/zone.umd.js:411:38)
at ZoneImpl.run (node_modules/zone.js/bundles/zone.umd.js:147:47)
at Object.wrappedFunc (node_modules/zone.js/bundles/zone-testing.umd.js:450:38)
My test project to show our problem can be found here
There is also a GitHub action showing the error here
Can someone help us figuring out what we are doing wrong?