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

Add CLI command to output a list of tests for better testNamePattern usage #2901

Open
4 tasks done
NullVoxPopuli opened this issue Feb 22, 2023 · 6 comments · May be fixed by #4240
Open
4 tasks done

Add CLI command to output a list of tests for better testNamePattern usage #2901

NullVoxPopuli opened this issue Feb 22, 2023 · 6 comments · May be fixed by #4240
Labels
enhancement New feature or request good first issue Good for newcomers p2-nice-to-have Not breaking anything but nice to have (priority) pr welcome

Comments

@NullVoxPopuli
Copy link

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

@sheremet-va
Copy link
Member

sheremet-va commented Oct 4, 2023

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?

@NullVoxPopuli
Copy link
Author

Or should we just run all test files without running test callbacks and output them?

yea, this is what mocha and qunit do

@sheremet-va sheremet-va added enhancement New feature or request good first issue Good for newcomers pr welcome p2-nice-to-have Not breaking anything but nice to have (priority) labels Oct 4, 2023
@sheremet-va
Copy link
Member

So, basically to have a command:

vitest list -t "some pattern I have"

@NullVoxPopuli
Copy link
Author

Exactly, yeah

@sheremet-va
Copy link
Member

sheremet-va commented Oct 4, 2023

Is there an output that you would expect with this command? Jest just prints file names.

@sheremet-va sheremet-va linked a pull request Oct 4, 2023 that will close this issue
8 tasks
@NullVoxPopuli
Copy link
Author

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' },
  ...
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers p2-nice-to-have Not breaking anything but nice to have (priority) pr welcome
Projects
Status: Approved
Development

Successfully merging a pull request may close this issue.

2 participants