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

cucumber-expressions: Bad (bad!) error message when using special characters. #345

Closed
Izhaki opened this issue Mar 20, 2018 · 4 comments · Fixed by cucumber/cucumber-ruby#346

Comments

@Izhaki
Copy link
Contributor

Izhaki commented Mar 20, 2018

Summary

Given (n) RETURN LIMIT

With:

Given('(n) RETURN LIMIT', (callback) => {
  // Write code here that turns the phrase above into concrete actions
  callback(null, 'pending');
});

Spits:

   ? Given (n) RETURN LIMIT
       Undefined. Implement with the following snippet:

         Given('(n) RETURN LIMIT', function (callback) {
           // Write code here that turns the phrase above into concrete actions
           callback(null, 'pending');
         });

I've just tried it 4051 times - copying your snippet to my code - and it doesn't work. It took 45 minutes - I could have watched another episode of Stranger Things instead.

Expected Behaviour

If I do what you tell me to do - it should work.

Current Behavior

I did what you told me to do - but it didn't work.

Possible Solution

If a step definition includes special characters, escape them in the snippet.

Much better than baffling us and make us find and read the docs:

If you ever need to match those parentheses literally, you can escape the first opening parenthesis with a backslash

Why should we fix this?

See Mind your output by Dan Abramov.

Related issues

#333 #107

@Izhaki
Copy link
Contributor Author

Izhaki commented Mar 20, 2018

By the way, I believe #334 is not published yet? In which case the docs are misleading.

  "devDependencies": {
    "cucumber": "^4.0.0",
  },

@aslakhellesoy
Copy link
Contributor

Thanks for reporting this.

It was interesting to hear about how many times you tried and what you could have done instead. I'm not sure how it helps fix the bug ;-)

@aslakhellesoy
Copy link
Contributor

Fixed in 5.0.14

@lock
Copy link

lock bot commented Apr 4, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants