pact-foundation / pact-workshop-js

Pact JS workshop - learn Pact in 60 minutes
https://pact.io
148 stars 154 forks source link

Step 3 - Running pact tests with 'npm run test:pact --prefix consumer' command tests fail with 'Error in native callback' #105

Closed druoid closed 1 year ago

druoid commented 1 year ago

Using a Mac OS Monterey 12.5.1 NPM version 9.6.4 Node version 18.15.0

In step3 Running pact tests with 'npm run test:pact --prefix consumer' command tests fail with 'Error in native callback'

`Error in native callback

  at Object.mockServerMismatches (node_modules/@pact-foundation/pact-core/src/consumer/index.ts:94:13)
  at PactV3.<anonymous> (node_modules/@pact-foundation/src/v3/pact.ts:207:39)
  at step (node_modules/@pact-foundation/pact/src/v3/pact.js:33:23)
  at Object.throw (node_modules/@pact-foundation/pact/src/v3/pact.js:14:53)
  at rejected (node_modules/@pact-foundation/pact/src/v3/pact.js:6:65)`

https://github.com/druoid/pact-workshop-js (no changes made to code)

mefellows commented 1 year ago

Thanks. It's probably a similar issue to the other workshop problem you raised.

druoid commented 1 year ago

I've replaced all entries of localhost with 127.0.0.1 however I still get the error.

jenswindmueller commented 1 year ago

Hello, are there any updates on the issue? I'm currently trying to learn Pact with JS but have the same issue.

mefellows commented 1 year ago

No updates sorry, but I should have linked to the "similar issue" -> https://github.com/pact-foundation/pact-js/discussions/1083

That might give you some pointers?

jenswindmueller commented 1 year ago

okay thanks for the tip! I've replaced all entries of localhost with 127.0.0.1 but I'm not able to do so on the consumer side as it is set up in a way that I'm not fimiliar with. Is there quick way that it can be changed to 127.0.0.1 for consumer? Thanks

mefellows commented 1 year ago

I think setting a host value to 127.0.0.1 in https://github.com/pact-foundation/pact-workshop-js/blob/master/consumer/src/api.pact.spec.js#L16 should do it.

YOU54F commented 1 year ago

Have updated all entries to use localhost and updated to the latest pact-js which help a majority of users