gpt4 book ai didi

mocha.js - Mocha/Nightmare测试失败,但仍在等待超时

转载 作者:行者123 更新时间:2023-12-03 13:24:09 28 4
gpt4 key购买 nike

我正在运行此测试(简化),该测试按预期失败了……但是,尽管失败了,但它仍要等待20秒的全部超时时间。如何使它立即失败?

it("should fail before timeout", function (done) {
var nightmare = new Nightmare({ show: true })
.goto(url)
.evaluate(function () {
})
.then(function (result) {
// this point is reached, and then the test just waits
// 20 seconds before finally failing
throw "Fail"
})
})

最佳答案

这是使用mocha的错误。而不是抛出,then应该使用Error对象调用完成。 (也将throw "Fail"替换为throw new Error("Fail"))

关于mocha.js - Mocha/Nightmare测试失败,但仍在等待超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41914166/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com