Qunit:如何在不知道acceptCallCount的情况下完成测试异步?
16lz
2021-01-22
Here is an example for Qunit test async, i want to finish it (result of the test) into the function async like is this example setTimeout :
这是Qunit测试异步的一个例子,我想完成它(测试的结果)到函数async就像这个例子setTimeout:
QUnit.test("test", function(assert) {
var done = assert.async(10); // 10 is just example
assert.ok(true, "succed");
done();
setTimeout(function () {
// here callback async, i want to finish the test,
// but i don't know the vlaue of acceptCallCount (assert.async(acceptCallCount));
}, 1000);
assert.ok(true, "succed");
done();
});
1 个解决方案
#1
0
(this is more a comment however too new for SO to comment!)
(这更像是一条评论,但对SO来说太新了评论!)
note that 'async' function comes with Qunit 2. Check your Qunit version.
请注意Qunit 2附带的'async'功能。检查您的Qunit版本。
Note that all the new APIs of QUnit 2.0 are already usable in QUnit 1.23.0
请注意,QUnit 2.0的所有新API都已在QUnit 1.23.0中使用
if you are before 1.23.0, you should upgrade or use the old method with Qunit.start().
如果您在1.23.0之前,则应该使用Qunit.start()升级或使用旧方法。
更多相关文章
- Node.js嬉皮API测试模块安装
- js“DOM事件”之鼠标事件、js的测试方法、js代码的放置位置
- 如何测试从实时网站提取数据的AJAX应用程序?
- JavaScript中可见性检查的测试条件
- 如何测试一个点是否是二次Bézier曲线的一部分?
- chai-as-promised:单个测试中的多个期望语句
- 如何测试潜在的“浏览器崩溃”JavaScript?
- How to learn js properly(week4)使用js建立的动态测试网页
- Python PyV8安装测试(Win7)