我成功地在我的Windows7上设置了JScover 0.2.0,到了http://localhost:8080/jscoverage.html上的页面,例如,我可以看到测试覆盖率在工作。
Jasmine测试是我的项目的JSCover文件夹中的'jasmine-ObjectTreeStructure-Tests.js'文件,我试图用它来运行staters。其他库和测试文件都驻留在这个文件夹中。
我通常通过在调试模式下运行项目来运行茉莉测试,然后导航到http://localhost:57263/FeatureDev/JavaScriptTestsWithDependencies.aspx。
这个页面包含茉莉花,jquery,.其他依赖项和许多需要测试的茉莉花测试.js文件。
如何将JSCover集成到JavaScriptTestsWithDependencies.aspx文件中,以便检查代码覆盖率。JavaScriptTestsWithDependencies.aspx是非常基础的。
<script type="text/javascript">
(function () {
"use strict";
var jasmineEnv = jasmine.getEnv();
jasmineEnv.updateInterval = 250;
var htmlReporter = new jasmine.HtmlReporter();
jasmineEnv.addReporter(htmlReporter);
jasmineEnv.specFilter = function (spec) {
return htmlReporter.specFilter(spec);
};
var currentWindowOnload = window.onload;
window.onload = function () {
if (currentWindowOnload) {
currentWindowOnload();
}
execJasmine();
};
function execJasmine() {
jasmineEnv.execute();
}
})();
</script>我尝试在JSCover中运行倒模 window.open('path/to/jscoverage.html');,添加
window.open('http://localhost:8080/jscoverage.html');
function execJasmine() {
jasmineEnv.execute();
}就在execJasmine方法之前,但这只会在弹出中用空白url打开jscoverage.html。
问题:在哪里以及如何插入JSCover,如果不可能,我的选择是什么?
发布于 2014-04-29 10:25:36
我成功地设置了JScover 0.2.0
首先,为什么不从https://sourceforge.net/projects/jscover/files/获取最新版本?
我通常通过在调试模式下运行项目来运行茉莉测试,然后导航到
http://localhost:57263/FeatureDev/JavaScriptTestsWithDependencies.aspx。
好的,在这种情况下,您不能在服务器模式下使用JSCover。为了使JavaScript能够正常工作,您必须在代理模式中运行JSCover,或者在进入http://localhost:57263/FeatureDev/JavaScriptTestsWithDependencies.aspx之前使用文件系统模式手动检测JavaScript。这两种方法都有这里的示例。
https://stackoverflow.com/questions/23341286
复制相似问题