2016-11-15 34 views
2

我面臨的問題開展工作,當我跑我的摩卡誘惑-記者,測試與摩卡成功運行的測試,但摩卡--reporter摩卡誘惑,記者返回以下錯誤摩卡誘惑,記者無法與節點JS

> [email protected] 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

問題可以通過更新你的摩卡到最新版本來解決,可能是v3或更高版本,也可以吸引記者。如果問題仍然存在關於TypeError: test.currentRetry is not a function,請通過以下方式

if (typeof test.currentRetry !== "function" || !test.currentRetry()) { 
替換代碼

if (!test.currentRetry()) {