in lib/plugins.ts [318:354]
private annotatePluginObj(obj: ProtractorPlugin, conf: PluginConfig, i: number): void {
let addAssertion =
(info: {specName?: string, stackTrace?: string}, passed: boolean, message?: string) => {
if (this.resultsReported) {
throw new Error(
'Cannot add new tests results, since they were already ' +
'reported.');
}
info = info || {};
const specName = info.specName || (obj.name + ' Plugin Tests');
const assertion: AssertionResult = {passed: passed};
if (!passed) {
assertion.errorMsg = message;
if (info.stackTrace) {
assertion.stackTrace = info.stackTrace;
}
}
this.assertions[specName] = this.assertions[specName] || [];
this.assertions[specName].push(assertion);
};
obj.name = obj.name || conf.name || conf.path || conf.package || ('Plugin #' + i);
obj.config = conf;
obj.addFailure = (message?, info?) => {
addAssertion(info, false, message);
};
obj.addSuccess = (options?) => {
addAssertion(options, true);
};
obj.addWarning = (message?, options?) => {
options = options || {};
logger.warn(
'Warning ' +
(options.specName ? 'in ' + options.specName : 'from "' + obj.name + '" plugin') + ': ' +
message);
};
}