Besoin d'aide pour résoudre le problème ci-dessus 'can not GET/states' pour http:/localhost: 8081/states. Je suis passé par https://groups.google.com/forum/#!topic/pact-support/zGj8o6snf5c, c'est très utile mais je n'ai pas trouvé la réponse.Implémentation d'un exemple Pact-js e2e [Problème: Can not GET/states] MAC OS
GitHub URL du référentiel: https://github.com/pactfoundation/pactjs/tree/master/examples/e2e
J'ai mis en place l'exemple Pact-js E2E sur ma machine OS X Capitaine IE [10,11].
- Exécutez le test de consommation
./node_modules/.bin/mocha test/consumer.spec.js
A obtenu la sortie réussie.
Pact
when a call to list all animals from the Animal Service is made
and there are animals in the database
✓ returns a list of animals
when a call to the Animal Service is made to retreive a single animal by ID
and there is an animal in the DB with ID 1
✓ returns the animal
and there no animals in the database
✓ returns a 404
when interacting with Animal Service
✓ should validate the interactions and create a contract
- Publish les essais
node test/publish.js
. J'ai la sortie réussie.
Pact contract publishing complete!
Head over to https://test.pact.dius.com.au/ and login with
=> Username: dXfltyFMgNOFZAxr8io9wJ37iUpY42M
=> Password: O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1
to see your published contracts.
- Exécutez le api consommateur et le fournisseur
npm run api
. Vous avez la sortie réussie
Animal Profile Service listening on http://localhost:8081
Animal Matching Service listening on http://localhots:8080
- Exécutez le test du fournisseur
./node_modules/.bin/mocha test/provider.spec.js
.got l'erreur ici
1) Uncaught error outside test suite
Pact Verification
Pact Verification Failed: Error: /Users/sakshi.rawal/work/pact-js/node_modules/@pact-foundation/pact-provider-verifier-darwin/lib/vendor/ruby/2.1.0/gems/json-1.8.3/lib/json/common.rb:155:in `parse': 757: unexpected token at 'Cannot GET /states (Faraday::ParsingError)
'
Pouvez-vous s'il vous plaît m'aider à résoudre l'erreur sur l'étape 4. Une autre question à l'étape 3 est lorsque je clique sur le lien dans la sortie, il ne demande pas de nom d'utilisateur et mot de passe.
Merci,
Sakshi
Corrigé au-dessus des étapes – Sakshi