Replies: 1 comment 1 reply
-
|
This makes a lot of sense to me. Feel free to open a PR, the team will discuss this in our next meeting |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, if you run
vitestwith no specific command, it defaults towatchmode: when tests finish, it stops and watches for changes, then re-runs them. You can press "q" to exit.This is true even when standard input is not a TTY. So if you do:
vitest < /dev/nullIt still stops and waits, but now there's no way to exit except to ctrl+C or otherwise kill the process.
If I opened a PR to change the behavior to default to "run" mode when standard input is not a TTY, would this be accepted?
(Or, alternatively solution: If standard input reaches EOF, can we consider that equivalent to pressing
q?)Here's my specific situation motivating this:
I've been experimenting with Claude Code, an AI assistant which is, uh, surprisingly good. I had written a new library, and I asked Claude to write tests for it. It wrote a beautiful test suite(!), added
"scripts": {"test": "vitest"}to my package.json, and then tried to run the tests withnpm run test. It then hung forever waiting for the tests to complete. Similarly, as I ask Claude to iterate on stuff, it frequently wants to run the tests usingnpm run test.My work-around is to change package.json to use
vitest run, but when I actually do run the tests interactively, I'd prefer the "watch" behavior. I can of course usenpx vitestinstead ofnpm run testwhen running interactively, but it seems like defaulting to "run" when run non-interactively would make sense, and would make vitest more friendly to AI assistants in general. People could of course still specifyvitest watchexplicitly even in non-interactive environments if that's what they really want.Beta Was this translation helpful? Give feedback.
All reactions