Add CLI command to output a list of tests for better testNamePattern usage
Clear and concise description of the problem
When using describe, it can be hard to narrow tests based on files/describe blocks -- especially when test names within describe blocks / test files may be repeated.
Suggested solution
As a debug utility, it could be great to be able to output the list of tests without running them so that folks can better utilize --testNamePattern
Alternative
No response
Additional context
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
What should happen if the test name is dynamic? How can we know the name in that case? Or should we just run all test files without running test callbacks and output them?
Or should we just run all test files without running test callbacks and output them?
yea, this is what mocha and qunit do
So, basically to have a command:
vitest list -t "some pattern I have"
Exactly, yeah
Is there an output that you would expect with this command? Jest just prints file names.
depends on output format, I suppose.
For stdout:
filename | describe | nested describe | test name
...
for json:
[
{ name: 'describe | nested describe | test name', file: 'file path' },
...
]