Skip to content

Commit

Permalink
Add support for Scenario Hooks (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
srbarrios authored Aug 17, 2021
1 parent 57c23f8 commit 4f546bb
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,23 @@ var generateReport = function (options) {
}
};

var parseScenarioHooks = function(data) {
return data.map(step => {
const match = step.match && step.match.location ? step.match : {location: 'can not be determined'};

if(step.embeddings == undefined){
return {}
}

return {
arguments: step.arguments || [],
result: step.result,
match,
embeddings: step.embeddings || []
}
})
};

var setStats = function (suite) {
var featureOutput = suite.features;
var topLevelFeatures = [];
Expand Down Expand Up @@ -218,6 +235,19 @@ var generateReport = function (options) {
return;
}

if (feature.elements) {
feature.elements.map(scenario => {
const {before, after} = scenario;

if (before) {
scenario.steps = parseScenarioHooks(before).concat(scenario.steps);
}
if (after) {
scenario.steps = scenario.steps.concat(parseScenarioHooks(after));
}
})
}

feature.elements.forEach(function (element) {
element.passed = 0;
element.failed = 0;
Expand Down

0 comments on commit 4f546bb

Please sign in to comment.