我正在尝试使用自定义 jasmine 报告器并获取 specDone 函数中所有失败规范的列表:
specDone: function(result) {
if(result.status == 'failed') {
failedExpectations.push(result.fullName);
console.log(failedExpectations);
}
}
Run Code Online (Sandbox Code Playgroud)
在哪里failedExpectations
将存储失败规范的完整列表,我需要afterLaunch
在量角器配置文件的函数中访问它。但是由于配置文件在每次运行新规范时都会加载,它基本上会被覆盖,并且范围使得我无法在afterLaunch
函数中访问它,这就是我调用 slack api 的地方。有没有办法实现这一目标?
这是我基于的内容:http : //jasmine.github.io/2.1/custom_reporter.html