我正在使用实习生 JS/leadfood 测试框架。我正在使用executeAsync。我希望将 executeAsync 的返回值传递给 executeAsync 的回调,但这并没有发生。以下工作应该有效吗?
return this.remote.get(require.toUrl(url));
//do stuff
.executeAsync(function (done) {
require([<library>],
function ([<function>]) {
return <function which returns Promise>
.then(function (value) {
return <function which returns Promise>
...
}).then(function () {
done(window.location);
})
})
})
.then(function (loc) {
console.log(loc);
})
执行成功到达 executeAsync 中的最后一个回调。成功调用 executeAsync 的回调。但是传递给 executeAsync 回调的值是undefined
.
编辑:
我发现即使您设置了一个非常大的 executeAsync 超时,如果您不调用this.async(timeout)
指定正确的超时(在撰写本文时默认为 30 秒),则此超时将被忽略。所以问题是测试花费的时间超过 30 秒,并且传递给 done 的值没有进入到 executeAsync 的回调。