Skip to content

Commit

Permalink
Rename skipped in pending #10
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaudan committed Jan 24, 2015
1 parent 169c178 commit 8cd0c2c
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 48 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ You can customize the output of the reporter yourself: [see how](https://github.
displayFailuresSummary: true, // display summary of all failures after execution
displaySuccessfulSpec: true, // display each successful spec
displayFailedSpec: true, // display each failed spec
displaySkippedSpec: false, // display each skipped spec
displayPendingSpec: false, // display each pending spec
displaySpecDuration: false, // display each spec duration
displaySuiteNumber: false, // display each suite number (hierarchical)
colors: {
success: 'green',
failure: 'red',
skipped: 'cyan'
pending: 'cyan'
},
prefixes: {
success: '✓ ',
failure: '✗ ',
skipped: '- '
pending: '- '
},
customProcessors: []
}
Expand Down
4 changes: 2 additions & 2 deletions customize-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You can then customize the following methods:
* displaySuite(suite, log)
* displaySuccessfulSpec(spec, log)
* displayFailedSpec(spec, log)
* displaySkippedSpec(spec, log)
* displayPendingSpec(spec, log)

The first argument is the jasmine object corresponding to the suite or the spec. The second argument is the log to be displayed. Those methods should return the modified log.

Expand Down Expand Up @@ -58,7 +58,7 @@ For our example:
return getTime() + " - " + log;
};

TimeProcessor.prototype.displaySkippedSpec = function (spec, log) {
TimeProcessor.prototype.displayPendingSpec = function (spec, log) {
return getTime() + " - " + log;
};

Expand Down
4 changes: 2 additions & 2 deletions example/run-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jasmine.getEnv().addReporter(new SpecReporter({
displayFailuresSummary: true,
displaySuccessfulSpec: true,
displayFailedSpec: true,
displaySkippedSpec: false,
displayPendingSpec: true,
displaySpecDuration: false,
displaySuiteNumber: false,
colors: {
Expand All @@ -22,7 +22,7 @@ jasmine.getEnv().addReporter(new SpecReporter({
prefixes: {
success: '✓ ',
failure: '✗ ',
skipped: '- '
pending: '- '
},
customProcessors: []
}));
Expand Down
8 changes: 4 additions & 4 deletions spec/custom-processor.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe 'spec reporter', ->
describe 'with custom processor', ->
beforeEach ->
@reporter = new SpecReporter
displaySkippedSpec: true
displayPendingSpec: true
customProcessors: [TestProcessor]
test: ' TEST'

Expand Down Expand Up @@ -39,9 +39,9 @@ describe 'spec reporter', ->
.contains /failed spec TEST/


it 'should report skipped with custom display', ->
it 'should report pending with custom display', ->
expect(new Test(@reporter,->
@describe 'suite', ->
@xit 'skipped spec', ->
@xit 'pending spec', ->
).outputs)
.contains /skipped spec TEST/
.contains /pending spec TEST/
2 changes: 1 addition & 1 deletion spec/helpers/test-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ TestProcessor.prototype.displayFailedSpec = function (spec, log) {
return log + this.test;
};

TestProcessor.prototype.displaySkippedSpec = function (spec, log) {
TestProcessor.prototype.displayPendingSpec = function (spec, log) {
return log + this.test;
};

Expand Down
36 changes: 18 additions & 18 deletions spec/jasmine-spec-reporter.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ describe 'spec reporter', ->
.contains /✗ failed spec/


it 'should not report skipped', ->
it 'should not report pending', ->
expect(new Test(@reporter,->
@describe 'suite', ->
@xit 'skipped spec', ->
@xit 'pending spec', ->
).outputs)
.not.contains /skipped spec/
.not.contains /pending spec/


describe 'when failed spec', ->
Expand Down Expand Up @@ -192,22 +192,22 @@ describe 'spec reporter', ->
]


it 'should report skipped whith success', ->
it 'should report pending whith success', ->
expect(new Test(@reporter,->
@describe 'suite', ->
@xit 'spec', ->
).summary)
.contains 'Executed 0 of 1 spec SUCCESS (skipped 1) in {time}.'
.contains 'Executed 0 of 1 spec SUCCESS (1 PENDING) in {time}.'


it 'should report skipped whith failure', ->
it 'should report pending with failure', ->
expect(new Test(@reporter,->
@describe 'suite', ->
@xit 'spec', ->
@it 'spec', ->
@failed()
).summary)
.toContain 'Executed 1 of 2 specs (1 FAILED) (skipped 1) in {time}.'
.toContain 'Executed 1 of 2 specs (1 FAILED) (1 PENDING) in {time}.'


describe 'with stacktrace enabled', ->
Expand Down Expand Up @@ -352,17 +352,17 @@ describe 'spec reporter', ->
expect(outputs).not.contains /failed spec/


describe 'with skipped spec enabled', ->
describe 'with pending spec enabled', ->
beforeEach ->
@reporter = new SpecReporter({displaySkippedSpec: true})
@reporter = new SpecReporter({displayPendingSpec: true})

describe 'when spec', ->
it 'should report skipped', ->
it 'should report pending', ->
expect(new Test(@reporter,->
@describe 'suite', ->
@xit 'skipped spec', ->
@xit 'pending spec', ->
).outputs)
.contains /- skipped spec/
.contains /- pending spec/


describe 'with spec duration enabled', ->
Expand Down Expand Up @@ -390,7 +390,7 @@ describe 'spec reporter', ->

describe 'with prefixes set to empty strings', ->
beforeEach ->
@reporter = new SpecReporter({displaySkippedSpec: true, prefixes: {success: '', failure: '', skipped: ''}})
@reporter = new SpecReporter({displayPendingSpec: true, prefixes: {success: '', failure: '', pending: ''}})

describe 'when spec', ->
it 'should report success', ->
Expand All @@ -411,17 +411,17 @@ describe 'spec reporter', ->
.not.contains //


it 'should report skipped', ->
it 'should report pending', ->
expect(new Test(@reporter,->
@describe 'suite', ->
@xit 'skipped spec', ->
@xit 'pending spec', ->
).outputs)
.not.contains /-/


describe 'with prefixes set to valid strings', ->
beforeEach ->
@reporter = new SpecReporter({displaySkippedSpec: true, prefixes: {success: 'Pass ', failure: 'Fail ', skipped: 'Skip '}})
@reporter = new SpecReporter({displayPendingSpec: true, prefixes: {success: 'Pass ', failure: 'Fail ', pending: 'Skip '}})

describe 'when spec', ->
it 'should report success', ->
Expand All @@ -442,9 +442,9 @@ describe 'spec reporter', ->
.not.contains //


it 'should report skipped', ->
it 'should report pending', ->
expect(new Test(@reporter,->
@describe 'suite', ->
@xit 'skipped spec', ->
@xit 'pending spec', ->
).outputs)
.not.contains /-/
2 changes: 1 addition & 1 deletion src/display-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DisplayProcessor.prototype.displayFailedSpec = function (spec, log) {
return log;
};

DisplayProcessor.prototype.displaySkippedSpec = function (spec, log) {
DisplayProcessor.prototype.displayPendingSpec = function (spec, log) {
return log;
};

Expand Down
6 changes: 3 additions & 3 deletions src/jasmine-spec-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function initColors(options) {
colors.setTheme({
success: options.colors && options.colors.success ? options.colors.success : 'green',
failure: options.colors && options.colors.failure ? options.colors.failure : 'red',
skipped: options.colors && options.colors.skipped ? options.colors.skipped : 'cyan'
pending: options.colors && options.colors.pending ? options.colors.pending : 'cyan'
});
}

Expand Down Expand Up @@ -79,8 +79,8 @@ SpecReporter.prototype = {
specDone: function (spec) {
this.metrics.stopSpec(spec);
if (spec.status == 'pending') {
this.metrics.skippedSpecs++;
this.display.skipped(spec);
this.metrics.pendingSpecs++;
this.display.pending(spec);
} else if (spec.status == 'passed') {
this.metrics.successfulSpecs++;
this.display.successful(spec);
Expand Down
2 changes: 1 addition & 1 deletion src/processors/default-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ function displaySpecDescription(spec) {

DefaultProcessor.prototype.displaySuccessfulSpec = displaySpecDescription;
DefaultProcessor.prototype.displayFailedSpec = displaySpecDescription;
DefaultProcessor.prototype.displaySkippedSpec = displaySpecDescription;
DefaultProcessor.prototype.displayPendingSpec = displaySpecDescription;

module.exports = DefaultProcessor;
4 changes: 2 additions & 2 deletions src/processors/spec-colors-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ SpecColorsProcessor.prototype.displayFailedSpec = function (spec, log) {
return log.failure;
};

SpecColorsProcessor.prototype.displaySkippedSpec = function (spec, log) {
return log.skipped;
SpecColorsProcessor.prototype.displayPendingSpec = function (spec, log) {
return log.pending;
};

module.exports = SpecColorsProcessor;
6 changes: 3 additions & 3 deletions src/processors/spec-prefixes-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function SpecPrefixesProcessor(prefixes) {
this.prefixes = {
success: prefixes && prefixes.success !== undefined ? prefixes.success : '✓ ',
failure: prefixes && prefixes.failure !== undefined ? prefixes.failure : '✗ ',
skipped: prefixes && prefixes.skipped !== undefined ? prefixes.skipped : '- '
pending: prefixes && prefixes.pending !== undefined ? prefixes.pending : '- '
}
}

Expand All @@ -18,8 +18,8 @@ SpecPrefixesProcessor.prototype.displayFailedSpec = function (spec, log) {
return this.prefixes.failure + log;
};

SpecPrefixesProcessor.prototype.displaySkippedSpec = function (spec, log) {
return this.prefixes.skipped + log;
SpecPrefixesProcessor.prototype.displayPendingSpec = function (spec, log) {
return this.prefixes.pending + log;
};

module.exports = SpecPrefixesProcessor;
12 changes: 6 additions & 6 deletions src/spec-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var SpecDisplay = function (options, displayProcessors) {
this.displayFailuresSummary = options.displayFailuresSummary !== false;
this.displaySuccessfulSpec = options.displaySuccessfulSpec !== false;
this.displayFailedSpec = options.displayFailedSpec !== false;
this.displaySkippedSpec = options.displaySkippedSpec || false;
this.displayPendingSpec = options.displayPendingSpec || false;
this.displayWithoutColors = options.colors === false;
this.displayProcessors = displayProcessors;
};
Expand All @@ -18,15 +18,15 @@ SpecDisplay.prototype = {
var execution = 'Executed ' + metrics.executedSpecs + ' of ' + metrics.totalSpecs + (metrics.totalSpecs === 1 ? ' spec ' : ' specs ');
var successful = (metrics.failedSpecs == 0) ? 'SUCCESS ' : '';
var failed = (metrics.failedSpecs > 0) ? '(' + metrics.failedSpecs + ' FAILED) ' : '';
var skipped = (metrics.skippedSpecs > 0) ? '(skipped ' + metrics.skippedSpecs + ') ' : '';
var pending = (metrics.pendingSpecs > 0) ? '(' + metrics.pendingSpecs + ' PENDING) ' : '';
var duration = 'in ' + metrics.duration + '.';

this.resetIndent();
this.newLine();
if (this.displayFailuresSummary && metrics.failedSpecs > 0) {
this.failuresSummary();
}
this.log(execution + successful.success + failed.failure + skipped + duration);
this.log(execution + successful.success + failed.failure + pending.pending + duration);
},

failuresSummary: function () {
Expand Down Expand Up @@ -71,12 +71,12 @@ SpecDisplay.prototype = {
}
},

skipped: function (spec) {
if (this.displaySkippedSpec) {
pending: function (spec) {
if (this.displayPendingSpec) {
this.ensureSuiteDisplayed(spec);
var log = null;
this.displayProcessors.forEach(function (displayProcessor) {
log = displayProcessor.displaySkippedSpec(spec, log);
log = displayProcessor.displayPendingSpec(spec, log);
});
this.log(log);
}
Expand Down
4 changes: 2 additions & 2 deletions src/spec-metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var SpecMetrics = function () {
this.duration = null;
this.successfulSpecs = 0;
this.failedSpecs = 0;
this.skippedSpecs = 0;
this.pendingSpecs = 0;
this.executedSpecs = 0;
this.totalSpecs = 0;
};
Expand All @@ -16,7 +16,7 @@ SpecMetrics.prototype = {

stop: function () {
this.duration = this.formatDuration((new Date()).getTime() - this.startTime);
this.totalSpecs = this.failedSpecs + this.successfulSpecs + this.skippedSpecs;
this.totalSpecs = this.failedSpecs + this.successfulSpecs + this.pendingSpecs;
this.executedSpecs = this.failedSpecs + this.successfulSpecs;
},

Expand Down

0 comments on commit 8cd0c2c

Please sign in to comment.