小编hea*_*nds的帖子

我如何订阅mocha套件活动?

我希望能够扩展mocha测试结果并从可用的mocha对象中收听它们.首先,我正在寻找获得"通行证"的结果.

看起来他们可能会从套房订阅,但我不确定如何......

我尝试过以下内容,我认为会听到我所有测试的结束:

var suite = mocha.suite.suites[0];
suite.on("end", function(e){ console.log(e, "mocha - heard the end of my test suite"); } );
Run Code Online (Sandbox Code Playgroud)

我的简单黑客有效,但根本不优雅 - 真的很伤心:

setTimeout(function(){ 
        var passes = $(".passes").find("em").text();
        console.log("ui - heard the end of my test suite - passes: " + passes); 
    }, 500);
Run Code Online (Sandbox Code Playgroud)

mocha.js

15
推荐指数
2
解决办法
6054
查看次数

标签 统计

mocha.js ×1