wdio-cucumber-framework
Advanced tools
@@ -133,5 +133,11 @@ import Cucumber from 'cucumber' | ||
let err = stepResult.getFailureException() | ||
error = { | ||
message: err.message, | ||
stack: err.stack | ||
if (err instanceof Error) { | ||
error = { | ||
message: err.message, | ||
stack: err.stack | ||
} | ||
} else { | ||
error = { | ||
message: err | ||
} | ||
} | ||
@@ -138,0 +144,0 @@ this.failedCount++ |
{ | ||
"name": "wdio-cucumber-framework", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "A WebdriverIO plugin. Adapter for Cucumber testing framework.", | ||
@@ -5,0 +5,0 @@ "main": "build/adapter.js", |
@@ -10,3 +10,3 @@ import sinon from 'sinon' | ||
function getEvent (name, status = 'pass', line = Math.round(Math.random() * 100), tags = []) { | ||
function getEvent (name, status = 'pass', line = Math.round(Math.random() * 100), tags = [], err = new Error('foobar-error')) { | ||
return { | ||
@@ -19,3 +19,3 @@ getPayloadItem: () => ({ | ||
getStatus: () => status, | ||
getFailureException: () => new Error('foobar-error'), | ||
getFailureException: () => err, | ||
getLine: () => line, | ||
@@ -74,3 +74,3 @@ getTags: () => tags.map(tag => ({ getName: () => tag })) | ||
it('should send proper data on handleStepResultEvent', () => { | ||
it('should send proper data on handleStepResultEvent for error of error type', () => { | ||
reporter.handleStepResultEvent(getEvent('step', 'failed', 126), NOOP) | ||
@@ -89,2 +89,16 @@ send.calledWithMatch({ | ||
it('should send proper data on handleStepResultEvent for error of string type', () => { | ||
reporter.handleStepResultEvent(getEvent('step', 'failed', 126, [], 'foo-error'), NOOP) | ||
send.calledWithMatch({ | ||
event: 'test:fail', | ||
type: 'test', | ||
title: 'step', | ||
cid: '0-1', | ||
parent: 'scenario124', | ||
uid: 'step126', | ||
file: 'foobar2' | ||
}).should.be.true() | ||
send.args[send.args.length - 1][0].err.message.should.be.equal('foo-error') | ||
}) | ||
it('should send proper data on handleAfterScenarioEvent', () => { | ||
@@ -132,3 +146,3 @@ reporter.handleAfterScenarioEvent(getEvent('scenario', null, 127), NOOP) | ||
it('should have right fail count at the end', () => { | ||
reporter.failedCount.should.be.exactly(1) | ||
reporter.failedCount.should.be.exactly(2) | ||
}) | ||
@@ -135,0 +149,0 @@ }) |
141208
0.56%3341
0.57%