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

Empty strings params trip parsing in v6+ #1241

Closed
jbblanchet opened this issue Oct 9, 2019 · 11 comments · Fixed by #1251
Closed

Empty strings params trip parsing in v6+ #1241

jbblanchet opened this issue Oct 9, 2019 · 11 comments · Fixed by #1251

Comments

@jbblanchet
Copy link

Repro in: https://github.com/jbblanchet/cucumber-error

Test Given string "" equals "" will crash with

.F

Failures:

1) Scenario: Empty String # features/strings.feature:6
   ✖ Given string "" equals "" # features/support/steps.js:4
       TypeError: Cannot read property 'replace' of undefined
           at World.<anonymous> (/home/jbb/temp/cucumber-error/node_modules/cucumber-expressions/dist/src/ParameterTypeRegistry.js:27:141)
           at ParameterType.transform (/home/jbb/temp/cucumber-error/node_modules/cucumber-expressions/dist/src/ParameterType.js:63:33)
           at Argument.getValue (/home/jbb/temp/cucumber-error/node_modules/cucumber-expressions/dist/src/Argument.js:29:35)

because the string is undefined, and not empty, and the code attempts to do undefined.replace. Not sure if the fix would be to parse the empty string as an empty string, to to check for undefined in cucumber-expressions. Also not sure this was the right repo to open the issue.

@charlierudolph
Copy link
Member

Interesting. Yep appears to be a bug. Will open an issue on cucumber-expressions (which lives in the cucumber monorepo)

@jbblanchet
Copy link
Author

@charlierudolph thanks for filing the bug there, I wasn't sure where it needed to be 😄

I noticed a fix was merged 9 days ago in the monorepo. Is there any plans to do a release? This is blocking our migration to v6.

Thanks

@gerbenlaan
Copy link

6.0.3 was released, but it still gives me the same error

@aslakhellesoy
Copy link
Contributor

@Gerb81 it will be included in the next release of cucumber-expressions: https://github.com/cucumber/cucumber/blob/master/cucumber-expressions/CHANGELOG.md

@aslakhellesoy
Copy link
Contributor

@Gerb81 I just released cucumber-expressions 8.0.2. Can you try again? (If you have a yarn.lock or package-lock.json pinning to 8.0.1 you'll have to yarn upgrade --latest or similar).

@gerbenlaan
Copy link

@aslakhellesoy it worked, thank you!

@FibreFoX
Copy link

FibreFoX commented Nov 4, 2019

@jbblanchet Can you check if this issue can get closed?

@jbblanchet
Copy link
Author

@FibreFoX sure. Didn't know you were waiting for me. I'll upgrade cucumber this morning and will let you know.

@jbblanchet
Copy link
Author

@FibreFoX It works with an caveat. If I ensure my cucumber-expressions is ^8.1.0 it'll work, but [email protected] is still only asking for cucumber-expressions ^8.0.1, which still has the bug. So with lockfiles, it's possible to still get the problem. For this issue to be truly closed, I think a 6.0.4 release that asks for the patched dependency would be preferable.

@davidjgoss
Copy link
Contributor

Opened a PR to explicitly update the dependency here.

@charlierudolph
Copy link
Member

charlierudolph commented Nov 11, 2019

v6.0.4 released with the updated dependency

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

Successfully merging a pull request may close this issue.

6 participants