Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Commit

Permalink
fix: Tests that call this.skip() are marked as failed instead of skip…
Browse files Browse the repository at this point in the history
…ped fix #77
  • Loading branch information
maksimr committed Nov 12, 2015
1 parent 61f57df commit 73e554f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ var createMochaReporterConstructor = function (tc, pathname) {
// - test end
// - pass
// - fail
// - pending

runner.on('start', function () {
tc.info({total: runner.total})
Expand All @@ -65,6 +66,10 @@ var createMochaReporterConstructor = function (tc, pathname) {
test.$errors = []
})

runner.on('pending', function (test) {
test.pending = true
})

runner.on('fail', function (test, error) {
if (test.type === 'hook') {
test.$errors = [formatError(error)]
Expand Down
15 changes: 15 additions & 0 deletions test/adapter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ describe('adapter mocha', function () {
expect(tc.result.called).to.eq(true)
})

it('should report skipped result', function () {
sandbox.stub(tc, 'result', function (result) {
expect(result.skipped).to.eq(true)
})

var mockMochaResult = {
parent: {root: true}
}

runner.emit('pending', mockMochaResult)
runner.emit('test end', mockMochaResult)

expect(tc.result.called).to.eq(true)
})

it('should report time 0 for skipped tests', function () {
sandbox.stub(tc, 'result', function (result) {
expect(result.skipped).to.eq(true)
Expand Down

0 comments on commit 73e554f

Please sign in to comment.