DiUS / pact-workshop-js-v1

Original Example JS project for the Pact workshop
Apache License 2.0
95 stars 42 forks source link

Pact tests fail after clean clone #2

Open andrew-fowler opened 6 years ago

andrew-fowler commented 6 years ago

Hi there. I'm not sure if this is an issue with the code, the documentation, or me, but the pact tests are failing for me on the first run.

With setup

Ran nvm use 6 Ran npm install Ran node provider/provider.js

test:consumer: passes test:pact:consumer: fails test:pact:provider: fails

test:pact:consumer

fails with

(node:56245) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): AssertionError: expected { Object (count, date) } to have a property 'count' of 100, but got 0.1

AssertionError: expected { Object (count, date) } to have a property 'date' of '2013-08-16T15:31:20+10:00', but got '2013-08-16T06:31:20+01:00'

passes if I change

          count: like(1000)

to

          count: like(1)

and

          expect(response).to.eventually.have.property('count', 100)
          expect(response).to.eventually.have.property('date', date).notify(done)

to

          expect(response).to.eventually.have.property('count', 100).notify(done)

test:pact:provider

fails with

  1) Uncaught error outside test suite
  Pact Verification
    2) should validate the expectations of Our Little Consumer

  0 passing (8s)
  2 failing

  1)  Uncaught error outside test suite:
     Uncaught Error: listen EADDRINUSE :::8081
      at Object.exports._errnoException (util.js:1018:11)
      at exports._exceptionWithHostPort (util.js:1041:20)
      at Server._listen2 (net.js:1258:14)
      at listen (net.js:1294:10)
      at Server.listen (net.js:1390:5)
      at EventEmitter.listen (node_modules/express/lib/application.js:618:24)
      at Object.<anonymous> (provider/test/providerPact.spec.js:23:8)
      at require (internal/module.js:20:19)
      at Array.forEach (native)
      at run (bootstrap_node.js:390:7)
      at startup (bootstrap_node.js:150:9)
      at bootstrap_node.js:505:3

If you could help with this, I'd really appreciate it.

mefellows commented 5 years ago

Ran node provider/provider.js ... Uncaught Error: listen EADDRINUSE :::8081

Something is running, probably your provider (you don't need to run that for the tests to run), which is conflicting with the port. You'll need to kill that process.

Some of those tests are designed to fail, but not in master. Have you gone through them by checking out step1, step2 etc.?

e.g.

git checkout step1
# read readme
# do things
git checkout step2
...

?