Skip to content

Commit

Permalink
fix: handle background section for new cucumber preprocessor format, …
Browse files Browse the repository at this point in the history
…address #139
  • Loading branch information
Oleksandr Shevtsov authored and Oleksandr Shevtsov committed Jun 29, 2022
1 parent 8311178 commit e39b4bd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions reporter/allure-cypress/CucumberHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ module.exports = class CucumberHandler {
return (
this.state.currentScenario ||
this.state.gherkinDocument.feature.children.find((child) =>
this.state.pickle.astNodeIds.includes(child.scenario.id)
this.state.pickle.astNodeIds.includes(
child.scenario && child.scenario.id
)
).scenario
);
}
Expand All @@ -46,7 +48,10 @@ module.exports = class CucumberHandler {
get outlineExampleIndex() {
if (this.isNewFormat) {
const [, exampleId] = this.state.pickle.astNodeIds;
if (!this.currentScenario.examples.length) {
if (
!this.currentScenario.examples ||
!this.currentScenario.examples.length
) {
return -1;
}
return this.currentScenario.examples[0].tableBody.findIndex(
Expand All @@ -66,7 +71,7 @@ module.exports = class CucumberHandler {
const currentTags = this.currentScenario.tags || [];
if (this.isNewFormat) {
const indexOfChild = this.feature.children.findIndex(
(child) => child.scenario.id === scenarioId
(child) => child.scenario && child.scenario.id === scenarioId
);
if (indexOfChild === -1) {
return;
Expand Down

0 comments on commit e39b4bd

Please sign in to comment.