Show message if no specs are found in console reporter

[#12784235]
This commit is contained in:
Christopher Amavisca, Greg Cobb and Luan Santos
2014-03-10 12:00:49 -07:00
parent af4cc76e2a
commit 3a5672cd33
3 changed files with 36 additions and 14 deletions

View File

@@ -71,7 +71,9 @@ getJasmineRequireObj().ConsoleReporter = function() {
specFailureDetails(failedSpecs[i]); specFailureDetails(failedSpecs[i]);
} }
if(specCount > 0) {
printNewline(); printNewline();
var specCounts = specCount + ' ' + plural('spec', specCount) + ', ' + var specCounts = specCount + ' ' + plural('spec', specCount) + ', ' +
failureCount + ' ' + plural('failure', failureCount); failureCount + ' ' + plural('failure', failureCount);
@@ -80,6 +82,9 @@ getJasmineRequireObj().ConsoleReporter = function() {
} }
print(specCounts); print(specCounts);
} else {
print('No specs found');
}
printNewline(); printNewline();
var seconds = timer.elapsed() / 1000; var seconds = timer.elapsed() / 1000;

View File

@@ -80,6 +80,18 @@ describe("ConsoleReporter", function() {
expect(out.getOutput()).toEqual("*"); expect(out.getOutput()).toEqual("*");
}); });
it("alerts user if there are no specs", function(){
var reporter = new j$.ConsoleReporter({
print: out.print
});
reporter.jasmineStarted();
out.clear();
reporter.jasmineDone();
expect(out.getOutput()).toMatch(/No specs found/);
});
it("reports a summary when done (singular spec and time)", function() { it("reports a summary when done (singular spec and time)", function() {
var timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']), var timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
reporter = new j$.ConsoleReporter({ reporter = new j$.ConsoleReporter({

View File

@@ -36,7 +36,9 @@ getJasmineRequireObj().ConsoleReporter = function() {
specFailureDetails(failedSpecs[i]); specFailureDetails(failedSpecs[i]);
} }
if(specCount > 0) {
printNewline(); printNewline();
var specCounts = specCount + ' ' + plural('spec', specCount) + ', ' + var specCounts = specCount + ' ' + plural('spec', specCount) + ', ' +
failureCount + ' ' + plural('failure', failureCount); failureCount + ' ' + plural('failure', failureCount);
@@ -45,6 +47,9 @@ getJasmineRequireObj().ConsoleReporter = function() {
} }
print(specCounts); print(specCounts);
} else {
print('No specs found');
}
printNewline(); printNewline();
var seconds = timer.elapsed() / 1000; var seconds = timer.elapsed() / 1000;