Closed
Description
🚀 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