I am using Mocha to run a number of tests. When I get to one particular set of tests:
我正在使用Mocha进行一些测试。当我进入一组特定的测试时:
describe "Results Summaries", ->
before (done) ->
Testing.use("surveyplanet_test")
Testing.initialUsers -> Testing.clearResultData ->
done()
beforeEach (done) ->
Testing.redis.flushdb -> done()
describe "Multiple Choice", ->
describe "Standard Choice Selection", ->
before (done) ->
Testing.clearResultData ->
Testing.loadQuestion "standardMC", ->
Testing.loadExportData
data: summarydata.standardMC
onComplete: done
describe "Pre-Summarization", ->
before (done) ->
answer_data = {}
Testing.getMultipleTables
tables: ["answers_main"]
onComplete: (data) ->
answer_data = data
done()
It throws the error:
它抛出错误:
Results Summaries 1) "before all" hook
结果摘要1)“在所有”钩子之前
✖ 1 of 340 tests failed:
340340次测试失败:
1) Results Summaries "before all" hook: Error: timeout of 2000ms exceeded at Object. (/usr/local/lib/node_modules/mocha/lib/runnable.js:142:14) at Timer.list.ontimeout (timers.js:101:19)
1)结果摘要“在所有之前”挂钩:错误:在对象超过2000ms的超时。 (/usr/local/lib/node_modules/mocha/lib/runnable.js:142:14)在Timer.list.ontimeout(timers.js:101:19)
Is there any way to get a stack trace for the piece of my code that threw the error?
有没有办法得到我的代码丢弃错误的堆栈跟踪?
1 个解决方案
#1
4
I'd try changing your reporter. I use
我试着改变你的记者。我用
mocha --compilers coffee:coffee-script *.coffee --ui bdd -d --watch -R Nyan
and get traces about 20 lines long when I have a failure.
mocha - 编译器咖啡:咖啡脚本* .coffee --ui bdd -d --watch -R Nyan并且当我失败时会得到大约20行的痕迹。
Timeouts usually mean (I've never seen it otherwise) that your done()
is not getting hit. I suspect one of these two:
超时通常意味着(我从未见过它)你的done()没有被击中。我怀疑这两个中的一个:
Testing.initialUsers -> Testing.clearResultData ->
Testing.initialUsers - > Testing.clearResultData - >
is not calling its callback.
没有调用它的回调。
#1
4
I'd try changing your reporter. I use
我试着改变你的记者。我用
mocha --compilers coffee:coffee-script *.coffee --ui bdd -d --watch -R Nyan
and get traces about 20 lines long when I have a failure.
mocha - 编译器咖啡:咖啡脚本* .coffee --ui bdd -d --watch -R Nyan并且当我失败时会得到大约20行的痕迹。
Timeouts usually mean (I've never seen it otherwise) that your done()
is not getting hit. I suspect one of these two:
超时通常意味着(我从未见过它)你的done()没有被击中。我怀疑这两个中的一个:
Testing.initialUsers -> Testing.clearResultData ->
Testing.initialUsers - > Testing.clearResultData - >
is not calling its callback.
没有调用它的回调。