question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

spreading args with regex

See original GitHub issue

We have a wrapper function which allows us to use the async/await feature as part of our tests.

so effectively what we pass to cucumbers steps is something like the following:

this.Then(/^I do(.+) on page (.+)$`/, function(...args){

  //do something with varying number of arguments - in our case we forward the args to the function which will actually do the testing
});

Currently this throws an error suggesting we are not catering for the number of args (in the case above it would be 3 (if returning promise or synchronous) and 4 (if using callbacks) required.

Is there a workaround for this use case? If not is there a way it can detect if we are catering for N arguments ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
leoseligcommented, Aug 10, 2017

I strongly believe this should be re-opened I’m hitting the same issue with spread-args Since they are super useful (especially for wrapping step functions in an idiomatic way) and ECMAScript-compliant I feel that cucumber-js should not prevent anyone from using language features

0reactions
lock[bot]commented, Dec 31, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Regex for matching Functions and Capturing their Arguments
I have a function that searches the expression for math functions using Regex, retrieves the arguments, looks up the function name, ...
Read more >
Regular expression syntax cheatsheet - JavaScript | MDN
This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the...
Read more >
Regular Expressions :: Eloquent JavaScript
A regular expression is a type of object. It can be either constructed with the RegExp constructor or written as a literal value...
Read more >
Quick Tip: How to Use the Spread Operator in JavaScript
The spread operator can be used to create and clone arrays and objects, pass arrays as function parameters, remove duplicates from arrays, ...
Read more >
Excel Regex: match strings using regular expressions - Ablebits
To match a string in a single cell, refer to that cell in the first argument. The second argument is supposed to contain...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found