我需要量角器配置文件中套件中提到的所有规范的列表,并且知道可能失败的原因。有没有办法做到这一点?我正在为此编写自定义茉莉花报告。
谢谢!
我需要量角器配置文件中套件中提到的所有规范的列表,并且知道可能失败的原因。有没有办法做到这一点?我正在为此编写自定义茉莉花报告。
谢谢!
您将在自定义 jasmine 报告器中使用类似的内容:
var suiteResults = [];
var currentSpecName;
var currentSpecStatus;
specStarted: function(spec) {
// get the name of the spec
console.log('Starting Spec: ' + spec.fullName);
currentSpecName = spec.fullName;
};
specDone: function(result) {
var passCount = result.passedExpectations.length;
var failCount = result.failedExpectations.length;
var expectationCount = passCount + failCount;
var specIsDisabled = result.status === 'disabled';
var specIsPending = result.status === 'pending';
var specIsInvalid = !specIsDisabled && !specIsPending && expectationCount === 0;
var specPassed = !specIsDisabled && !specIsPending && !specIsInvalid && failCount === 0;
var specFailed = !specIsDisabled && !specIsPending && !specIsInvalid && !specPassed;
currentSpecStatus = specFailed ? 'FAILED' : 'PASSED';
console.log('Status: ' + currentSpecStatus);
suiteResults.push({specName: currentSpecName, specStatus: currentSpecStatus});
};
suiteDone: function() {
var specCount = suiteResults.length;
var failCount = suiteResults.filter(function(result) {
return result.specStatus === 'FAILED';
}).length;
console.log(specCount + ' specs, ' + failCount + ' failures');
},