Skip to content

Commit 250d69a

Browse files
author
Glib Briia
authored
Fixes #604 - remove line overwriting for scenario outlines in cucumber formatter (#605)
1 parent 5a5631a commit 250d69a

File tree

4 files changed

+20
-22
lines changed

4 files changed

+20
-22
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ This project adheres to [Semantic Versioning](http://semver.org).
77
This document is formatted according to the principles of [Keep A CHANGELOG](http://keepachangelog.com).
88

99
## Unreleased
10-
10+
### Fixed
11+
- Remove line overwriting for scenario outlines in cucumber formatter ([605](https://github.com/cucumber/godog/pull/605) - [glibas](https://github.com/glibas))
12+
1113
## [v0.13.0]
1214
### Added
1315
- Support for reading feature files from an `fs.FS` ([550](https://github.com/cucumber/godog/pull/550) - [tigh-latte](https://github.com/tigh-latte))

features/formatter/cucumber.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ Feature: cucumber json formatter
323323
{
324324
"keyword": "Given ",
325325
"name": "passing step",
326-
"line": 11,
326+
"line": 7,
327327
"match": {
328328
"location": "suite_context.go:64"
329329
},
@@ -345,7 +345,7 @@ Feature: cucumber json formatter
345345
{
346346
"keyword": "Given ",
347347
"name": "failing step",
348-
"line": 12,
348+
"line": 7,
349349
"match": {
350350
"location": "suite_context.go:47"
351351
},

internal/formatters/fmt_cucumber.go

-4
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,6 @@ func (f *Cuke) buildCukeStep(pickle *messages.Pickle, stepResult models.PickleSt
252252
step := feature.FindStep(pickleStep.AstNodeIds[0])
253253

254254
line := step.Location.Line
255-
if len(pickle.AstNodeIds) == 2 {
256-
_, row := feature.FindExample(pickle.AstNodeIds[1])
257-
line = row.Location.Line
258-
}
259255

260256
cukeStep.Name = pickleStep.Text
261257
cukeStep.Line = int(line)

internal/formatters/formatter-tests/cucumber/scenario_outline

+15-15
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
{
4747
"keyword": "Given ",
4848
"name": "passing step",
49-
"line": 13,
49+
"line": 6,
5050
"match": {
5151
"location": "fmt_output_test.go:101"
5252
},
@@ -58,7 +58,7 @@
5858
{
5959
"keyword": "When ",
6060
"name": "passing step",
61-
"line": 13,
61+
"line": 7,
6262
"match": {
6363
"location": "fmt_output_test.go:101"
6464
},
@@ -70,7 +70,7 @@
7070
{
7171
"keyword": "Then ",
7272
"name": "odd 1 and even 2 number",
73-
"line": 13,
73+
"line": 8,
7474
"match": {
7575
"location": "fmt_output_test.go:103"
7676
},
@@ -110,7 +110,7 @@
110110
{
111111
"keyword": "Given ",
112112
"name": "passing step",
113-
"line": 14,
113+
"line": 6,
114114
"match": {
115115
"location": "fmt_output_test.go:101"
116116
},
@@ -122,7 +122,7 @@
122122
{
123123
"keyword": "When ",
124124
"name": "passing step",
125-
"line": 14,
125+
"line": 7,
126126
"match": {
127127
"location": "fmt_output_test.go:101"
128128
},
@@ -134,7 +134,7 @@
134134
{
135135
"keyword": "Then ",
136136
"name": "odd 2 and even 0 number",
137-
"line": 14,
137+
"line": 8,
138138
"match": {
139139
"location": "fmt_output_test.go:103"
140140
},
@@ -175,7 +175,7 @@
175175
{
176176
"keyword": "Given ",
177177
"name": "passing step",
178-
"line": 15,
178+
"line": 6,
179179
"match": {
180180
"location": "fmt_output_test.go:101"
181181
},
@@ -187,7 +187,7 @@
187187
{
188188
"keyword": "When ",
189189
"name": "passing step",
190-
"line": 15,
190+
"line": 7,
191191
"match": {
192192
"location": "fmt_output_test.go:101"
193193
},
@@ -199,7 +199,7 @@
199199
{
200200
"keyword": "Then ",
201201
"name": "odd 3 and even 11 number",
202-
"line": 15,
202+
"line": 8,
203203
"match": {
204204
"location": "fmt_output_test.go:103"
205205
},
@@ -240,7 +240,7 @@
240240
{
241241
"keyword": "Given ",
242242
"name": "passing step",
243-
"line": 20,
243+
"line": 6,
244244
"match": {
245245
"location": "fmt_output_test.go:101"
246246
},
@@ -252,7 +252,7 @@
252252
{
253253
"keyword": "When ",
254254
"name": "passing step",
255-
"line": 20,
255+
"line": 7,
256256
"match": {
257257
"location": "fmt_output_test.go:101"
258258
},
@@ -264,7 +264,7 @@
264264
{
265265
"keyword": "Then ",
266266
"name": "odd 1 and even 14 number",
267-
"line": 20,
267+
"line": 8,
268268
"match": {
269269
"location": "fmt_output_test.go:103"
270270
},
@@ -304,7 +304,7 @@
304304
{
305305
"keyword": "Given ",
306306
"name": "passing step",
307-
"line": 21,
307+
"line": 6,
308308
"match": {
309309
"location": "fmt_output_test.go:101"
310310
},
@@ -316,7 +316,7 @@
316316
{
317317
"keyword": "When ",
318318
"name": "passing step",
319-
"line": 21,
319+
"line": 7,
320320
"match": {
321321
"location": "fmt_output_test.go:101"
322322
},
@@ -328,7 +328,7 @@
328328
{
329329
"keyword": "Then ",
330330
"name": "odd 3 and even 9 number",
331-
"line": 21,
331+
"line": 8,
332332
"match": {
333333
"location": "fmt_output_test.go:103"
334334
},

0 commit comments

Comments
 (0)