spreading args with regex
See original GitHub issueWe 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:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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.