javascript - 未处理的 promise 拒绝 AVA

标签 javascript node.js promise ava unhandled

我想使用 ava 来测试我的代码,但是当我尝试它时,我收到以下错误...我认为缺少一个 catch (err)...

(node:7640) UnhandledPromiseRejectionWarning: C:\...\TesBoard-db\node_modules\ava\lib\node-arguments.js:9
                } catch {
                        ^

(node:7640) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7640) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

知道如何解决这个问题吗?

提前致谢。

最佳答案

是的,update Node 。 <- 他们在该问题线程中推荐 Node.js 12.15。

为了将来的引用,以及 StackOverflow,当堆栈中存在任何抛出或行为异常的内容时,您需要搜索 GitHub 问题。

关于javascript - 未处理的 promise 拒绝 AVA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60381954/

相关文章:

jquery - 将 Promise 与 Q 结合起来

javascript - 访问请求 promise 中的 header 获取响应

node.js - 使用 validate.js 解决所有异步 promise

javascript - 组合不同的 Javascript 框架有缺点吗?

linux - 如何在树莓派/或任何基于 Linux 的 PC 上托管 NodeJS http Web 服务器

node.js - sailsjs v0.11 和express-validator

node.js - Mailgun messages().send没有明显效果

javascript - Ajax 调用时的 "Waiting for response"消息

javascript - Async-await 'Promise {<pending>} with Array.prototype.map

javascript - Jquery - 条件不起作用