7

我正在使用 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()

它抛出错误:

结果总结 1)“首先”钩子

✖ 340 次测试中有 1 次失败:

1) 结果摘要“首先”钩子:错误:对象超过 2000 毫秒的超时。(/usr/local/lib/node_modules/mocha/lib/runnable.js:142:14) 在 Timer.list.ontimeout (timers.js:101:19)

有什么方法可以获取引发错误的代码段的堆栈跟踪吗?

4

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.

Timeouts usually mean (I've never seen it otherwise) that your done() is not getting hit. I suspect one of these two:

Testing.initialUsers -> Testing.clearResultData ->

is not calling its callback.

于 2013-03-01T22:47:33.517 回答