Skip to content

Commit a58bb60

Browse files
More fixes for codeceptjs >= 3.4.0
1 parent 6825ba1 commit a58bb60

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### 1.0.11
2+
3+
- More fixes for Codeceptjs >= 3.4.0
4+
5+
---
6+
17
### 1.0.10
28

39
- Fix reporter to work with Codeceptjs 3.4.0 Cucumber update

index.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ module.exports = function (config) {
198198
const clonedBackground = _.cloneDeep(backgroundSteps);
199199
reportScenarioObject.steps = [...clonedBackground, ...steps];
200200

201-
if (codeceptScenarioObject.examples === undefined) {
201+
if (codeceptScenarioObject.examples === undefined || codeceptScenarioObject.examples.length === 0) {
202202
allScenarios.push(reportScenarioObject);
203203
} else {
204204
const separatedOutlines = separateScenarioOutline(codeceptScenarioObject, reportScenarioObject);
@@ -262,8 +262,25 @@ module.exports = function (config) {
262262
embeddings: [],
263263
};
264264

265+
// update to handle codecept >= 3.4.0
266+
const buildArgument = () => {
267+
let arg = null;
268+
if (codeceptStepObject.docString) {
269+
arg = {
270+
type: 'DocString',
271+
content: codeceptStepObject.docString.content,
272+
};
273+
}
274+
if (codeceptStepObject.dataTable) {
275+
arg = {
276+
type: 'DataTable',
277+
...codeceptStepObject.dataTable,
278+
};
279+
}
280+
return arg;
281+
};
265282
// get all arguments for a step
266-
const { argument } = codeceptStepObject;
283+
const argument = codeceptStepObject.argument || buildArgument();
267284
if (argument) reportStep.arguments.push(getArgumentsFromCodecept(argument));
268285
allSteps.push(reportStep);
269286
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeceptjs-cucumber-json-reporter",
3-
"version": "1.0.10",
3+
"version": "1.0.11",
44
"description": "CodeceptJS plugin to generate a cucumberjs json output",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)