需要幫助解決上述問題'http/localhost:8081/states不能GET/states'。我已經通過https://groups.google.com/forum/#!topic/pact-support/zGj8o6snf5c,這是非常有幫助,但沒有找到答案。Pact-js e2e示例實現[問題:無法獲取/狀態] MAC操作系統
GitHub的庫網址:https://github.com/pactfoundation/pactjs/tree/master/examples/e2e
我已經設置了該條約,JS E2E例如我的機器OS X EI船長[10.11]上。
- 運行消費者測試
./node_modules/.bin/mocha test/consumer.spec.js
獲得了成功的輸出。
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
- 發佈測試
node test/publish.js
。得到了成功的輸出。 - 執行消費者和提供者API
npm run api
。得了成功輸出 - 運行提供商測試
./node_modules/.bin/mocha test/provider.spec.js
.GOT錯誤這裏
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.
Animal Profile Service listening on http://localhost:8081
Animal Matching Service listening on http://localhots:8080
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)
'
您可以幫我解決第4步中的錯誤。 第3步的另一個問題是,當我點擊輸出中的鏈接時,它不要求用戶名和密碼。上面列出
謝謝,
Sakshi
更正上述步驟 – Sakshi