Commit 0c39e151 0c39e1513893e83efbcefd3adb36e658b593c523 by Nicolas Perriault

added --concise option

1 parent 6fab583f
......@@ -99,6 +99,7 @@ var Tester = function Tester(casper, options) {
post: []
};
this.options = utils.mergeObjects({
concise: false, // concise output?
failFast: false, // terminates a suite as soon as a test fails?
failText: "FAIL", // text to use for a succesful test
passText: "PASS", // text to use for a failed test
......@@ -818,7 +819,9 @@ Tester.prototype.begin = function begin(description, planned, suiteFn) {
return this.queue.push(arguments);
}
description = description || "Untitled suite in " + this.currentTestFile;
this.comment(description);
if (!this.options.concise) {
this.comment(description);
}
this.currentSuite = new TestCaseResult({
name: description,
file: this.currentTestFile,
......@@ -836,6 +839,13 @@ Tester.prototype.begin = function begin(description, planned, suiteFn) {
}
this.done();
}
if (this.options.concise) {
this.casper.echo([
this.colorize('PASS', 'INFO'),
this.formatMessage(description),
this.colorize(f('(%d test%s)', planned, planned > 1 ? 's' : ''), 'INFO')
].join(' '));
}
};
/**
......@@ -1060,7 +1070,9 @@ Tester.prototype.processAssertionResult = function processAssertionResult(result
style = 'RED_BAR';
status = this.options.failText;
}
this.casper.echo([this.colorize(status, style), this.formatMessage(message)].join(' '));
if (!this.options.concise) {
this.casper.echo([this.colorize(status, style), this.formatMessage(message)].join(' '));
}
this.emit(eventName, result);
if (this.options.failFast && !result.success) {
throw this.SKIP_MESSAGE;
......
......@@ -60,6 +60,7 @@ function checkArgs() {
casper.options.colorizerType = cls;
casper.colorizer = colorizer.create(cls);
}
casper.test.options.concise = casper.cli.get('concise') || false;
casper.test.options.failFast = casper.cli.get('fail-fast') || false;
// test paths are passed as args
......
......@@ -120,7 +120,6 @@ casper.test.begin('ClientUtils.getElementBounds() tests', 3, function(test) {
);
});
casper.then(function() {
test.comment('Casper.getElementsBounds()');
var html = '<div id="boxes">';
html += ' <div style="position:fixed;top:10px;left:11px;width:50px;height:60px"></div>';
html += ' <div style="position:fixed;top:20px;left:21px;width:70px;height:80px"></div>';
......