-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
CLI doesn't currently allow choosing filename test pattern until all tests are completed #3128
Comments
You can pass the filename pattern as CLI argument when starting Vitest.
You might want to look into poolMatchGlobs: [
// These tests depend on APIs unavailable in worker_threads, run them in child_process instead:
['**/tests/**/some-name.*', 'child_process'],
] |
I know we can pass a pattern directly to the CLI but that is not exactly what I'm asking here and I would never start Vitest with a pattern since I always start it in watch mode. What I'm saying is really that Jest allows us to use the keyboard at any point in time to change pattern or even quit the CLI (Jest never blocks keyboard input). This is not the case with Vitest, it blocks keyboard input (or simply doesn't listen) when a test (or all tests) are running and that is a problem. |
The CLI argument does exactly what the issue title asks for but maybe that's just nitpicking about the title. So the request here is to be able to stop test execution in watch mode. I think this is a bit related to #1459, or at least would enable that feature once implemented. |
Feel free to change the title with more appropriate description and yes I would like to be able to use any of the CLI options at any point in time and not have to wait for the entire test execution to complete in watch mode (which in my case is 1.5-2min on Windows, so it's painful to wait that long). Jest allows me to do that at any point in time but Vitest doesn't. It's not exactly like #1459, I would be nice for sure but it's not really the problem that I'm trying to highlight here. We can't seem to be able to use any CLI option (by keyboard event) when the test execution is in progress (for example try typing "q" to quit and Vitest is unresponsive to it until the test execution is completed) |
The keypress is currently intentionally blocked when tests are running. There is no support for stopping on-going test execution at the moment. vitest/packages/vitest/src/node/stdin.ts Lines 40 to 42 in be1bf08
|
Thanks for confirming, that's what I taught. If you guys prefer to have this locked by default, then I wouldn't mind having to unlock via a flag. |
Describe the bug
I'm migrating Jest unit tests to Vitest in Lerna-Lite (a very light fork of Lerna) and I need to use
--no-threads
because a few tests requires the use ofprocess.chdir()
and because of the no thread, it takes well over a 2min for all tests to complete and during that period the CLI is locked and I cannot use the CLI filename pattern. That's not the case in Jest, I can type in a pattern right after the CLI process starts. I'm on Windows and I know the Lerna/Lerna-Lite tests are running slower on Windows, so the fact that I'm on Windows might be worst for me but still I think the CLI should allow keyboard events even when the unit tests are being performedReproduction
Have a long running unit test suite and while it's running (and not completed), try choosing any CLI options while the test runs and you'll see that you can't. That's also true for all CLI commands, for example you can't Quit, by typing "q", until all unit tests are finished.
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: