Skip to content
This repository was archived by the owner on Dec 18, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class CucumberReporter {
title: this.getTitle(feature),
type: 'suite',
file: uri,
tags: feature.tags
tags: feature.tags,
description: feature.description,
keyword: feature.keyword
})
}

Expand Down Expand Up @@ -86,6 +88,7 @@ class CucumberReporter {
}
let error = {}
let stepTitle = step.text || step.keyword || 'Undefined Step'
let dataTable = []

/**
* if step name is undefined we are dealing with a hook
Expand Down Expand Up @@ -139,6 +142,12 @@ class CucumberReporter {
}
}

if (step.argument && step.argument.hasOwnProperty('rows')) {
dataTable = [{
rows: step.argument.rows.map(row => ({cells: row.cells.map(cell => cell.value)}))
}]
}

this.emit('test:' + e, {
uid: this.getUniqueIdentifier(step),
title: stepTitle.trim(),
Expand All @@ -147,7 +156,9 @@ class CucumberReporter {
parent: this.getUniqueIdentifier(scenario),
error: error,
duration: new Date() - this.testStart,
tags: scenario.tags
tags: scenario.tags,
keyword: step.keyword,
argument: dataTable
})
}

Expand Down Expand Up @@ -192,7 +203,10 @@ class CucumberReporter {
specs: this.specs,
tags: payload.tags || [],
featureName: payload.featureName,
scenarioName: payload.scenarioName
scenarioName: payload.scenarioName,
description: payload.description,
keyword: payload.keyword || null,
argument: payload.argument
}

this.send(message, null, {}, () => ++this.receivedMessages)
Expand Down
46 changes: 44 additions & 2 deletions test/reporter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const gherkinDocEvent = {
location: { line: 123, column: 1 },
keyword: 'Feature',
name: 'feature',
description: ' This is a feature description\n Second description',
children: [{
type: 'Background',
location: { line: 124, column: 0 },
Expand All @@ -40,13 +41,54 @@ const gherkinDocEvent = {
location: { line: 126, column: 0 },
keyword: 'Scenario',
name: 'scenario',
description: ' This should be a scenario description',
steps: [
{
location: { line: 127, column: 1 },
type: 'Step',
location: {line: 127, column: 1},
keyword: 'Given ',
text: 'step-title-passing'
text: 'step-title-passing',
argument: {
type: 'DataTable',
location: { line: 15, column: 13 },
rows: [
{
type: 'TableRow',
location: { line: 15, column: 13 },
cells: [
{
type: 'TableCell',
location: { line: 15, column: 15 },
value: 'Cucumber'
},
{
type: 'TableCell',
location: { line: 15, column: 30 },
value: 'Cucumis sativus'
}
]
},
{
type: 'TableRow',
location: { line: 16, column: 13 },
cells: [
{
type: 'TableCell',
location: { line: 16, column: 15 },
value: 'Burr Gherkin'
},
{
type: 'TableCell',
location: { line: 16, column: 30 },
value: 'Cucumis anguria'
}
]
}
]
}
},
{
type: 'Step',
location: { line: 128, column: 1 },
keyword: 'When ',
text: 'step-title-failing'
Expand Down