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 tests fail with timeout on pact server setup #186

Closed anjali-traceIW closed 4 years ago

anjali-traceIW commented 4 years ago

Getting failing pact tests with error:

Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

Jest seems to start running tests before the pact server is up. Increasing the timeout range at index.js:19 seems to resolve this issue:

beforeAll(function () { return pactMock.setup(); }, 30000);

Using 0.4.5

TimothyJones commented 4 years ago

Are you providing a different timeout with the options?

With default options, the Jest timeout should already be 30000 by the time that beforeAll is called.

TimothyJones commented 4 years ago

Oh, apologies - the improved timeout handling was introduced in 0.4.6. Updating will fix your issue :+1:

I'll close this for now, feel free to reopen if you have further issues.