我第一次使用Pact.js进行微服务测试。 我试图按照这些例子如下:所有pact-js测试都失败,出现同样的错误
https://github.com/pact-foundation/pact-js/tree/master/examples/e2e
https://github.com/pact-foundation/pact-js/tree/master/examples/mocha
在实施例3;我浏览到测试文件夹,运行mocha index.spec.js
但它引发以下错误:
[2017-02-27T21:37:52.426Z] INFO: [email protected]/38629 on Meliss-MacBook-Pro.local: Creating Pact with PID: 38630
1) "before all" hook
2) "after all" hook
0 passing (2s)
2 failing
1) The Dog API "before all" hook:
Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
2) The Dog API "after all" hook:
Error: connect ECONNREFUSED 127.0.0.1:8989
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1087:14)
它创建log
和pact
文件夹如预期,但它既不在协议文件夹中创建一个pact.json
文件,也没有在日志中记录文件夹。
让我更困惑的是我得到了例1和例2中完全相同的错误。 这告诉我,我有一个问题在我身边,但我不知道它是什么。 有人可以帮我调试这个问题吗?
你可以看看'。/ logs/mockserver-integration.log'并粘贴内容的要点吗? –
@MatthewFellows感谢您的回复。不幸的是这个文件是空的。 – melis
不用担心。你可以尝试一些在https://github.com/pact-foundation/pact-node/issues/30中讨论的技巧吗?这个问题是针对验证过程的,但包括在节点外测试Ruby进程和检查端口等许多事情都与本次讨论有关。 –