Support standalone + a filename pattern in the CLI
Clear and concise description of the problem
I want to use --standalone as the default behaviour in our test script because it normally doesn't make sense for people to run the entire suite, e.g.
"test": "vitest --standalone --coverage"
But I still want people to be able to pass a path if they want to run a subset of tests. e.g.
yarn test src/whatever
# file path is ignored, no tests run
It would be great if we could default to standalone but still allow people to pass a path. I know you can also press p and type a path, but
- people aren't as familiar with that
- when you're typing a path there it doesn't let you tab to complete the file path
Is there some existing way to do this?
Suggested solution
When given a file path in the CLI vitest could make that the default filename pattern. It would behave the same as when you do
-
vitest --standalone - press
p - type the path and press enter
Alternative
We could have two scripts in our app, one that has standalone enabled and one that doesn't, but we never really want the version that runs all the tests for local development, and when we do we could just run standalone and press a.
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.