We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The current formats do not provide a way to skip some parameters in the test name output when test data is array.
For example,
it.each([ ['row1', { ...params1 }, 'expected1'], ['row2', { ...params2 }, 'expected2'], ])('%#. %s => %s %s', (row, param, expected) => tester()) // This will return // 0. row1 => {...params1} expected1 // 1. row2 => {...params2} expected2 // The middle params is always displayed
Although we can work around
I'm hoping to have more flexibility to control which param is shown in test name.
Format %_ indicates that parameter is skipped in the test name
%_
it.each([ ['row1', { ...params1 }, 'expected1'], ['row2', { ...params2 }, 'expected2'], ])('%#. %s => %_%s', (row, param, expected) => tester()) // This will return // 0. row1 => expected1 // 1. row2 => expected2 // The middle params is omitted
No response
The text was updated successfully, but these errors were encountered:
How about supporting element index of array like object? https://stackblitz.com/edit/vitest-dev-vitest-wvqa9r6r?file=test%2Fbasic.test.ts
// this works it.each([ { 0: 'row1', 1: {}, 2: 'expected1' }, { 0: 'row2', 1: {}, 2: 'expected2' }, ])('%#. $0 => $2', () => {}); // ✓ 0. 'row1' => 'expected1' // ✓ 1. 'row2' => 'expected2' // but this doesn't currently it.each([ ['row1', {}, 'expected1'], ['row2', {}, 'expected2'], ])('%#. $0 => $2', () => {}); // ✓ 0. $0 => $2 // ✓ 1. $0 => $2
(Currently object key $x gets quoted but that'll be fixed by #5946)
$x
Sorry, something went wrong.
test.each/for
Successfully merging a pull request may close this issue.
Clear and concise description of the problem
The current formats do not provide a way to skip some parameters in the test name output when test data is array.
For example,
Although we can work around
I'm hoping to have more flexibility to control which param is shown in test name.
Suggested solution
Format
%_
indicates that parameter is skipped in the test nameAlternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: