萨尔瓦多,
嘿。我发现问题出在 qunit-logging.js 中。当我从您的 index.html 中删除它时,测试运行良好。
这是我在 phantomjs 中运行 qunit 所做的。\
C:\temp\qunit_test>c:\phantom\phantomjs.exe runner.js file:///c:/temp/qunit_test/index.html
Results:
Beginning test...
Test should now end...
Took 2045ms to run 1 tests. 1 passed, 0 failed.
此外,我确实更新了 qunit 源以从 cdn 运行。我不知道您使用的是什么版本(我只能说 2012 年的版本),我想使用最新版本进行故障排除。所以这是我的 index.html 文件:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test Suite</title>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<!-- qunit -->
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.12.0.css" type="text/css" media="screen" />
<script src="http://code.jquery.com/qunit/qunit-1.12.0.js"></script>
<!--<script src="qunit-logging.js"></script>-->
<script type='text/javascript'>
module("lib-test");
asyncTest ("async test", function() {
expect(1);
console.log("Beginning test...");
setTimeout(function() {
start();
ok(true, "true is true");
console.log("Test should now end...");
}, 2000);
});
</script>
</body>
</html>