Skip to content

Commit

Permalink
Print attachment step text on error format
Browse files Browse the repository at this point in the history
  • Loading branch information
DevSide committed Feb 15, 2018
1 parent df5843d commit 9ea6b03
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion features/error_formatting.feature
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Feature: Error formatting
"""
import {Given} from 'cucumber'
Given(/^a basic step$/, function() {})
Given(/^a basic step$/, function() { this.attach('Basic info.') })
Given(/^a step with a doc string$/, function(str) {})
Given(/^a pending step$/, function() { return 'pending' })
"""
Expand All @@ -65,6 +65,7 @@ Feature: Error formatting
1) Scenario: some scenario # features/a.feature:3
✔ Given a basic step # features/step_definitions/cucumber_steps.js:3
ℹ Basic info.
✔ And a step with a doc string # features/step_definitions/cucumber_steps.js:4
\"\"\"
my doc string
Expand Down
13 changes: 13 additions & 0 deletions src/formatter/helpers/issue_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,21 @@ function formatStep({
if (actionLocation) {
text += ` # ${colorFns.location(formatLocation(actionLocation))}`
}

text += '\n'

if (Array.isArray(testStep.attachments)) {
testStep.attachments
.filter(({ media }) => media.type === 'text/plain')
.forEach(({ data }) => {
text +=
indentString(
colorFns[Status.UNDEFINED](figures.info + ' ' + data),
4
) + '\n'
})
}

if (pickleStep) {
let str
const iterator = buildStepArgumentIterator({
Expand Down

0 comments on commit 9ea6b03

Please sign in to comment.