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

test.each: Support formatting for variable number of arguments #9737

Closed
l-abels opened this issue Apr 1, 2020 · 4 comments
Closed

test.each: Support formatting for variable number of arguments #9737

l-abels opened this issue Apr 1, 2020 · 4 comments

Comments

@l-abels
Copy link

l-abels commented Apr 1, 2020

🚀 Feature Proposal

Allow the test.each test name to format inputs of variable length cleanly. Allow for the previous behavior to be re-enabled or add a special operator that uses Array.join() behind the scenes.

Motivation

test.each can support inputs of varying length if the test function makes the uses of the spread operator (...). However, there's no good way to format the test name such that each test includes all of the arguments. #6342 disabled the default util.inspect behavior that would have allowed for this.

Example

Proposal 1:

 it.todo.each ([
    ['Red', 'Blue'],
    ['Purple', 'Yellow', 'Green'],
  ]) ('Looks good with the following colors: ');
Looks good with the following colors: Red Blue
Looks good with the following colors: Purple Yellow Green

Proposal 2:

 it.todo.each ([
    ['Garlic', 'Smashed', 'Chopped'],
    ['Beef', 'Sliced', 'Salted', 'Grilled'],
  ]) ('%s can be prepared in the order %a{ -> }');
Garlic can be prepared in the order Smashed -> Chopped
Beef can be prepared in the order Sliced -> Salted -> Grilled
@jeysal
Copy link
Contributor

jeysal commented Apr 1, 2020

cc @mattphillips

@github-actions
Copy link

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Feb 25, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions
Copy link

github-actions bot commented May 4, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants