Pact-js e2e 示例实现[问题:无法获取/states] MAC OS
Pact-js e2e example implementation[Issue:Cannot GET /states] MAC OS
需要解决上述问题的帮助 'cannot GET /states' 对于 http:/localhost:8081/states。我已经完成了 https://groups.google.com/forum/#!topic/pact-support/zGj8o6snf5c,很有帮助但没有找到答案。
GitHub 存储库 URL:https://github.com/pactfoundation/pactjs/tree/master/examples/e2e
我已经在我的机器上设置了 Pact-js e2e 示例 OS X EI Captain[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
。得到成功的输出。
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.
- 运行 消费者和提供者 api
npm run api
。得到成功输出
Animal Profile Service listening on http://localhost:8081
Animal Matching Service listening on http://localhots:8080
- 运行 供应商测试
./node_modules/.bin/mocha test/provider.spec.js
。此处出现错误
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 步的另一个问题是,当我单击输出中的 link 时,它不要求输入用户名和密码。
谢谢,
萨克什
上面列出的步骤 3 不是必需的,它只是测试和使用 运行ning API。
我怀疑第 4 步无法 运行 具有额外端点的提供程序,因为它已经 运行 在第 3 步中的同一端口上连接,因此失败。这意味着它无法在验证过程中找到端点 /states。
关闭所有进程,然后 运行 第 4 步和该端点应该被添加,并且测试应该通过。
你能仔细检查一下你是否下载了最新的代码吗?看起来像一个不喜欢现有内容类型的传递依赖性发生了变化。我前几天打了补丁。
需要解决上述问题的帮助 'cannot GET /states' 对于 http:/localhost:8081/states。我已经完成了 https://groups.google.com/forum/#!topic/pact-support/zGj8o6snf5c,很有帮助但没有找到答案。
GitHub 存储库 URL:https://github.com/pactfoundation/pactjs/tree/master/examples/e2e
我已经在我的机器上设置了 Pact-js e2e 示例 OS X EI Captain[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
。得到成功的输出。
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.
- 运行 消费者和提供者 api
npm run api
。得到成功输出
Animal Profile Service listening on http://localhost:8081
Animal Matching Service listening on http://localhots:8080
- 运行 供应商测试
./node_modules/.bin/mocha test/provider.spec.js
。此处出现错误
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 步的另一个问题是,当我单击输出中的 link 时,它不要求输入用户名和密码。
谢谢,
萨克什
上面列出的步骤 3 不是必需的,它只是测试和使用 运行ning API。
我怀疑第 4 步无法 运行 具有额外端点的提供程序,因为它已经 运行 在第 3 步中的同一端口上连接,因此失败。这意味着它无法在验证过程中找到端点 /states。
关闭所有进程,然后 运行 第 4 步和该端点应该被添加,并且测试应该通过。
你能仔细检查一下你是否下载了最新的代码吗?看起来像一个不喜欢现有内容类型的传递依赖性发生了变化。我前几天打了补丁。