在浏览器中查看Karmatesting输出?

我是Karma的新手,但是我想知道如何在浏览器中查看它的输出(就像当Jasper与Runner.html文件交互时那样)。

我观看了介绍性的截屏video,并且我理解如何在控制台窗口中查看testing输出,但是在我的浏览器中,我几乎没有得到噶的内容,除了

噶 – 连接

请指教! 我想避免必须维护一个单独的runner.html文件,因为Karmaconfiguration文件已经要求我包含所有必要的脚本链接。

AFAIK,前面的两个答案是正确的,你要在浏览器中运行testing; 单击DEBUG并在控制台中查看输出。

在礼貌上与前面的答案相矛盾,我经常使用Karma进行全面的variables交互并进行debugging。

你的问题的正确答案,因为你想要的是基于HTML的输出,是“不”。 然而,这个业力插件可能会给你你想要的结果。

https://npmjs.org/package/karma-html-reporter

您需要在karma.conf.js使用singleRun = false运行它,然后单击顶部angular落中显示“DEBUG”的button。 那么你应该看到输出,它不会消失或closures。 您也可以使用控制台进行debugging。

值得注意的是,debugginge2etesting不是那么容易,因为它们是“未来”的基础,所以你将无法截取值(afaik)。

一种select是在浏览器中打开Javascript控制台。 Karma为每个testing创build一个日志条目,包括结果。

我想用Karma来显示HTML5 Web Notifications ,所以我写了一些东西来使它和Karma 0.11一起工作。 可能与其他版本稍有不同。 我将这个脚本加载到其他应用程序脚本中,它将存储karmatesting结果,并在完成后确定testing的成功,然后重置为原始的karma函数,以便在脚本运行时不会更改再次。

 // store all my test results var results = []; // Wrap the karma result function var resultFunc = window.__karma__.result; window.__karma__.result = function(result){ // run the original function resultFunc(result); // push each result on my storage array results.push(result); } // wrap the karma complete function var completeFunc = window.__karma__.complete; window.__karma__.complete = function(result){ // run the original function completeFunc(result); // determine success var success = results.every(function(r){ return r.success }); if (success) { // display a success notification } else { // display a test failure notification } // reset the result function window.__karma__.result = resultFunc; // reset the complete function window.__karma__.complete = completeFunc; } 
Interesting Posts