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 · 3 comments

Comments

Projects
None yet
2 participants
@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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

aslakhellesoy commented Mar 24, 2018

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

This comment has been minimized.

Copy link
Contributor

aslakhellesoy commented Apr 4, 2018

Fixed in 5.0.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.