Skip to content

Commit

Permalink
More fixes for codeceptjs >= 3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ktryniszewski-mdsol committed Feb 24, 2023
1 parent 6825ba1 commit a58bb60
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 1.0.11

- More fixes for Codeceptjs >= 3.4.0

---

### 1.0.10

- Fix reporter to work with Codeceptjs 3.4.0 Cucumber update
Expand Down
21 changes: 19 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ module.exports = function (config) {
const clonedBackground = _.cloneDeep(backgroundSteps);
reportScenarioObject.steps = [...clonedBackground, ...steps];

if (codeceptScenarioObject.examples === undefined) {
if (codeceptScenarioObject.examples === undefined || codeceptScenarioObject.examples.length === 0) {
allScenarios.push(reportScenarioObject);
} else {
const separatedOutlines = separateScenarioOutline(codeceptScenarioObject, reportScenarioObject);
Expand Down Expand Up @@ -262,8 +262,25 @@ module.exports = function (config) {
embeddings: [],
};

// update to handle codecept >= 3.4.0
const buildArgument = () => {
let arg = null;
if (codeceptStepObject.docString) {
arg = {
type: 'DocString',
content: codeceptStepObject.docString.content,
};
}
if (codeceptStepObject.dataTable) {
arg = {
type: 'DataTable',
...codeceptStepObject.dataTable,
};
}
return arg;
};
// get all arguments for a step
const { argument } = codeceptStepObject;
const argument = codeceptStepObject.argument || buildArgument();
if (argument) reportStep.arguments.push(getArgumentsFromCodecept(argument));
allSteps.push(reportStep);
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codeceptjs-cucumber-json-reporter",
"version": "1.0.10",
"version": "1.0.11",
"description": "CodeceptJS plugin to generate a cucumberjs json output",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit a58bb60

Please sign in to comment.