(function() {
var BALLOT_X = '✗';
var CHECKMARK = '✓';
var DOWN_RIGHT_ARROW = '↳';
var PASSED = 'passed';
var lastSpecStartTime;
function ConsoleReporter(options) {
var startTime = new Date().getTime();
var errorCount = 0, pending = [];
this.jasmineStarted = function (obj) {
print('Jasmine started with ' + obj.totalSpecsDefined + ' tests.');
};
this.jasmineDone = function (obj) {
var ERROR = errorCount === 1 ? 'error' : 'errors';
var endTime = new Date().getTime();
print('
');
if (errorCount === 0) {
print ('All enabled tests passed!');
} else {
print('Tests completed with ' +
errorCount + ' ' + ERROR + '.');
}
if (pending.length) {
print ('disabled:
'+
pending.join('
')+'');
}
print('Tests completed in ' + (endTime - startTime) + 'ms.');
};
this.suiteStarted = function(obj) {
print(obj.fullName);
};
this.suiteDone = function(obj) {
print('');
};
this.specStarted = function(obj) {
lastSpecStartTime = new Date().getTime();
};
this.specDone = function(obj) {
if (obj.status === 'pending') {
pending.push(obj.fullName);
return print('...(pending ' + obj.fullName +')');
}
var specEndTime = new Date().getTime();
var symbol = obj.status === PASSED ?
'' + CHECKMARK + '' :
'' + BALLOT_X + '';
print('... ' + obj.fullName + ' ' + symbol + ' ' + '[' +
(specEndTime - lastSpecStartTime) + 'ms]');
var specErrors = obj.failedExpectations.length;
errorCount += specErrors;
for (var i = 0; i < specErrors; i++) {
print('' + DOWN_RIGHT_ARROW +
' ' +
obj.failedExpectations[i].message + '');
}
};
return this;
}
setTimeout = Script.setTimeout;
setInterval = Script.setInterval;
clearTimeout = Script.clearTimeout;
clearInterval = Script.clearInterval;
var jasmine = this.jasmine = jasmineRequire.core(jasmineRequire);
var env = jasmine.getEnv();
env.addReporter(new ConsoleReporter());
var jasmineInterface = jasmineRequire.interface(jasmine, env);
extend(this, jasmineInterface);
function extend(destination, source) {
for (var property in source) {
if (source.hasOwnProperty(property)) {
destination[property] = source[property];
}
}
return destination;
}
}());