Skip to content

Commit

Permalink
fix, clean, doc
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaudan committed Aug 12, 2014
1 parent 004dcf1 commit 160937f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 33 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ Real time console spec reporter for jasmine behavior-driven development testing
success: 'green',
failure: 'red',
skipped: 'cyan'
},
prefixes: {
success: '✓ ',
failure: '✗ ',
skipped: '- '
}
}

Expand Down
5 changes: 5 additions & 0 deletions example/example-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ jasmine.getEnv().addReporter(new jasmine.SpecReporter({
success: 'green',
failure: 'red',
skipped: 'cyan'
},
prefixes: {
success: '',
failure: '',
skipped: '- '
}
}))

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "Spec reporter for jasmine behavior-driven development framework",
"main": "src/jasmine-spec-reporter.js",
"scripts": {
"test": "./node_modules/jasmine-node/bin/jasmine-node --coffee --noStack spec",
"example": "./node_modules/jasmine-node/bin/jasmine-node --coffee example"
"test": "node node_modules/jasmine-node/bin/jasmine-node --coffee --noStack spec",
"example": "node node_modules/jasmine-node/bin/jasmine-node --coffee example"
},
"repository": {
"type": "git",
Expand Down
34 changes: 6 additions & 28 deletions spec/jasmine-spec-reporter.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ describe 'spec reporter', ->
''
]


it 'should report skipped whith success', ->
expect(new Test(@reporter,->
@describe 'suite', ->
Expand Down Expand Up @@ -323,6 +324,7 @@ describe 'spec reporter', ->
@failed()
).outputs).not.contains /failed suite/


it 'should display not fully failed suite', ->
outputs = new Test(@reporter,->
@describe 'failed suite', ->
Expand Down Expand Up @@ -372,6 +374,7 @@ describe 'spec reporter', ->
).outputs)
.contains /✗ failed spec \({time}\)/


describe 'with prefixes set to empty strings', ->
beforeEach ->
@reporter = new jasmine.SpecReporter({displaySkippedSpec: true, prefixes: {success: '', failure: '', skipped: ''}})
Expand All @@ -394,13 +397,15 @@ describe 'spec reporter', ->
).outputs)
.not.contains //


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


describe 'with prefixes set to valid strings', ->
beforeEach ->
@reporter = new jasmine.SpecReporter({displaySkippedSpec: true, prefixes: {success: 'Pass ', failure: 'Fail ', skipped: 'Skip '}})
Expand All @@ -423,41 +428,14 @@ describe 'spec reporter', ->
).outputs)
.not.contains //


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

describe 'with prefixes not set', ->
beforeEach ->
@reporter = new jasmine.SpecReporter({displaySkippedSpec: true, prefixes: {} })

describe 'when spec', ->
it 'should report success', ->
expect(new Test(@reporter,->
@describe 'suite', ->
@it 'successful spec', ->
@passed()
).outputs)
.contains //


it 'should report failure', ->
expect(new Test(@reporter,->
@describe 'suite', ->
@it 'failed spec', ->
@failed()
).outputs)
.contains //

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

describe 'with jasmine callback hack', ->
beforeEach ->
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 @@ -123,7 +123,7 @@ SpecDisplay.prototype = {
this.ensureSuiteDisplayed(spec.suite);
var result = spec.results().description;
var duration = this.displaySpecDuration ? ' (' + spec.duration + ')' : '';
this.log(this.prefixes.success + result.success + duration)
this.log(this.prefixes.success.success + result.success + duration)
}
},

Expand All @@ -133,7 +133,7 @@ SpecDisplay.prototype = {
this.ensureSuiteDisplayed(spec.suite);
var result = spec.results().description;
var duration = this.displaySpecDuration ? ' (' + spec.duration + ')' : '';
this.log(this.prefixes.failure + result.failure + duration);
this.log(this.prefixes.failure.failure + result.failure + duration);
this.displayErrorMessages(spec);
}
},
Expand All @@ -142,7 +142,7 @@ SpecDisplay.prototype = {
if (this.displaySkippedSpec) {
this.ensureSuiteDisplayed(spec.suite);
var result = spec.results().description;
this.log(this.prefixes.skipped + result.skipped)
this.log(this.prefixes.skipped.skipped + result.skipped)
}
},

Expand Down

0 comments on commit 160937f

Please sign in to comment.