Skip to content

Cucumber JSON report fails to generate when a scenario outline has a tag #1621

@xenbartolokath

Description

@xenbartolokath

Cucumber Version: 7.0.0
Node Version: 14.15.0
Operating System: MacOS Big Sur v11.2.1

Given this following test case:

@parent_tag
Scenario Outline: Sample test case
Given this is a test case
When I have the following data table
| <scenario_example> |
Then a JSON report will be generated

@child_tag_1
Examples:
| scenario_example |
| Test Child Tag 1 |

@child_tag_2
Examples:
| scenario_example |
| Test Child Tag 2 |

When I run the test case above with the tag: "--tags @child_tag_2" and "-f json:reports/cucumber-report.json", the test case runs successfully, but upon generating an report, the following error occurs:

TypeError: Cannot read property 'location' of undefined
    at /Users/project-folder/node_modules/@cucumber/cucumber/lib/formatter/json_formatter.js:185:34
    at arrayMap (/Users/project-folder/node_modules/lodash/lodash.js:653:23)
    at Function.map (/Users/project-folder/node_modules/lodash/lodash.js:9622:14)
    at JsonFormatter.getScenarioTags (/Users/project-folder/node_modules/@cucumber/cucumber/lib/formatter/json_formatter.js:180:33)
    at JsonFormatter.getScenarioData (/Users/project-folder/node_modules/@cucumber/cucumber/lib/formatter/json_formatter.js:125:24)
    at /Users/project-folder/node_modules/@cucumber/cucumber/lib/formatter/json_formatter.js:84:29
    at Array.map (<anonymous>)
    at /Users/project-folder/node_modules/@cucumber/cucumber/lib/formatter/json_formatter.js:69:36
    at /Users/project-folder/node_modules/lodash/lodash.js:3585:27
    at /Users/project-folder/node_modules/lodash/lodash.js:4967:15
    at baseForOwn (/Users/project-folder/node_modules/lodash/lodash.js:3032:24)
    at /Users/project-folder/node_modules/lodash/lodash.js:4936:18
    at baseMap (/Users/project-folder/node_modules/lodash/lodash.js:3584:7)
    at Function.map (/Users/project-folder/node_modules/lodash/lodash.js:9622:14)
    at JsonFormatter.onTestRunFinished (/Users/project-folder/node_modules/@cucumber/cucumber/lib/formatter/json_formatter.js:63:43)
    at EventEmitter.<anonymous> (/Users/project-folder/node_modules/@cucumber/cucumber/lib/formatter/json_formatter.js:23:22)

Therefore I can't generate any JSON report.

I tried removing the scenario outline example tags and it proceeded with generating the JSON report.

Metadata

Metadata

Labels

🐛 bugDefect / Bug✅ acceptedThe core team has agreed that it is a good idea to fix this

Type

No type

Projects

Status

Released

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions