我有一個測試失敗在摩卡與此錯誤。如何在Mocha測試中調試「錯誤:無諾或拒絕原因拒絕承諾」?
我已經把catch
陳述放在每個承諾鏈的末尾,拋出它們通過的任何錯誤,但它們從不被調用。
然而測試保持與下面的錯誤而失敗:
Error: Promise rejected with no or falsy reason
at tryCatcher (node_modules/bluebird/js/main/util.js:26:23)
at Promise._settlePromiseFromHandler (node_modules/bluebird/js/main/promise.js:507:31)
at Promise._settlePromiseAt (node_modules/bluebird/js/main/promise.js:581:18)
at Promise._settlePromises (node_modules/bluebird/js/main/promise.js:697:14)
at Async._drainQueue (node_modules/bluebird/js/main/async.js:123:16)
at Async._drainQueues (node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (node_modules/bluebird/js/main/async.js:15:14)
我如何找出問題到底是什麼,其承諾被拒絕,並得到一個更有意義的痕跡?
這將有助於包含您的測試代碼。 –