Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Gherkin reporter throwing Exception "Cannot read property 'concat' of undefined" #89

Closed
kabomi opened this issue Jun 7, 2022 · 5 comments

Comments

@kabomi
Copy link

kabomi commented Jun 7, 2022

Hi @Arthy000,

I'm trying to use your new reporters and I'm not able to make them to work.

grafik

It looks like this line is failing across several report files (e.g. gtc-reporter-list.js:75):

meta.steps
      .map((step) => keywords[step.type].concat(step.text))

As you can see on the Screenshot, I'm printing the content of meta. It is supposed to have steps with a property 'type' with either of the keys contained here: { Context: 'Given ', Action: 'When ', Outcome: 'Then ' }. But I'm getting undefined

This is how it looks my step code:

import { Before, Given, Then, When } from '@cucumber/cucumber';
...
Then(/^a field helper text message is shown with the text "(.+)"$/, async (test, [message]) => {
    await t.expect(await activityPage.getHelperErrorMessageFrom('field-selection')).contains(message);
});

package.json relevant dependencies:

"@cucumber/cucumber-expressions": "^15.2.0",
"@cucumber/cucumber": "8.2.2",
"testcafe": "~1.19.0"
"testcafe-reporter-cucumber-json": "6.3.0",

Command that I'm executing:
gherkin-testcafe chrome e2e/**/*.steps.ts e2e/features/**/*.feature --debug-on-fail -r gtc-reporter-list,cucumber-json:.cucumber-stdout-ignore --config-file .testcaferc.local.json --tags @List,@Details,@Filter,@Create,@Edit,@Error,@Translation

I've tried to use only one reporter (via command line -r gtc-reporter-list) but same error dropped.

I've also tried to use the standard reporter (no command line -r argument) but same error dropped.

Any ideas?

Thanks

@Arthy000
Copy link
Owner

Arthy000 commented Jun 8, 2022

Hi @kabomi
You are the second one to get this but I don't see how it could be, because the type value comes straight from the gherkin parser provided by Cucumber.

Could you show me your Feature file too? Maybe there's something there.

Meanwhile you can use spec instead of the custom reporter by setting -r spec in the CLI (or runner.reporter("spec") if you're using the API)

Arthy000 added a commit that referenced this issue Jun 8, 2022
switched const to let because variable was modified, added a fallback string to concat the step name
because was sometimes undefined

re #89 #90
@Arthy000
Copy link
Owner

Arthy000 commented Jun 8, 2022

The new version I just released will fix the issue, but you will have no information about the type of step because the gherkin compiler returns undefined, so I'm keeping this ticket open to investigate that

Arthy000 added a commit that referenced this issue Jun 8, 2022
sometimes no keyword is provided, this should not make the reporter crash

re #89
@Arthy000
Copy link
Owner

Arthy000 commented Jun 8, 2022

Forgot to add the fix to all the reporters, so version 5.4.2 it is

@kabomi
Copy link
Author

kabomi commented Jun 9, 2022

I tested version 5.4.2 and now it works 👍
grafik

P.S. It looks that there is a break-line missing between the Feature description and the first step description

@Arthy000
Copy link
Owner

Arthy000 commented Jun 9, 2022

Indeed, will fix that in next version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants