Mocha-allure-reporter不使用节点js

时间:2016-11-15 06:23:47

标签: node.js unit-testing mocha node-modules allure

我在使用mocha-allure-reporter进行测试时遇到问题,测试使用 mocha 成功运行,但 mocha --reporter mocha-allure-reporter 返回以下错误

> notifications-api@1.0.0 test /app
> mocha --reporter mocha-allure-reporter

2016-11-15T06:13:26.762Z - info: Notification API up and running on port 4000
2016-11-15T06:13:26.773Z - error: Tue, 15 Nov 2016 06:13:26 GMT uncaughtException
2016-11-15T06:13:26.775Z - error: TypeError: test.currentRetry is not a function
at Runner.<anonymous> (/app/node_modules/mocha-allure-reporter/index.js:29:19)
at emitOne (events.js:77:13)
at Runner.emit (events.js:169:7)
at next (/app/node_modules/mocha/lib/runner.js:517:10)
at Runner.runTests (/app/node_modules/mocha/lib/runner.js:556:3)
at /app/node_modules/mocha/lib/runner.js:637:10
at next (/app/node_modules/mocha/lib/runner.js:283:14)
at Immediate._onImmediate (/app/node_modules/mocha/lib/runner.js:319:5)
at processImmediate [as _immediateCallback] (timers.js:383:17)
npm ERR! Test failed.  See above for more details.

任何人都可以帮忙解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

问题可以通过将你的摩卡更新到最新版本可能解决到v3或更高版本并引诱记者。如果TypeError: test.currentRetry is not a function问题仍然存在,请替换代码行

if (!test.currentRetry()) {

以下

if (typeof test.currentRetry !== "function" || !test.currentRetry()) {