-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 Argument Parsing is Broken with --single-thread
#3107
Comments
Interestingly, this doesn't seem to have the same error
It allows the tests to run with the inspector enabled, but the file-path filtering is totally ignored; rather than filtering on that file name, it ignores the filters and just starts running all of the tests. |
I don't think it's possible to pass it down like that. |
The difference of these two comes from here: vitest/packages/vitest/src/node/config.ts Lines 109 to 114 in 326b242
We are explicitly looking for As the described workflow of this issue is expected to be common I think we should explicitly convert these flags to |
Yes, but it will not work as described in the issue. The issue wants the same as:
But if we just coerce it will be
If I understand it correctly. |
I think this issue about these two commands:
The second one is not working currently. #3111 fixes it. |
I'm not sure that #3111 addressed this issue in its entirety. Or rather, while it resolved the original issue around parsing the arguments, other issues around using these flags remain. It seems that now, additional filters after the arguments to launch Vitest with the debugger enabled are just ignored entirely If I run the following, just my one yarn vitest App.test If I do the same, but with the debugging commands provided, it does launch in debugging mode, but starts running all of my tests yarn vitest --inspect-brk --single-thread App.test I would expect that the behavior here is that it launches just |
I'm able to reproduce this. It seems that kebab-case vs camelCase produces different results. I wonder if this is a bug in # Runs only 'math.test.ts' with single thread
$ vitest run --singleThread tests/math.test.ts
# Runs all tests in single thread
$ vitest run --single-thread tests/math.test.ts |
import { cac } from "cac";
const cli = cac("repro");
cli.option("--single-thread", "Testing");
console.log(JSON.stringify(cli.parse(), null, 2)); $ node cac-repro.mjs --single-thread tests/file.test.ts
{
"args": [],
"options": {
"--": [],
"singleThread": "tests/file.test.ts"
}
}
$ node cac-repro.mjs --singleThread tests/file.test.ts
{
"args": [
"tests/file.test.ts"
],
"options": {
"--": [],
"singleThread": true
}
} |
Maybe add "1" or "y" after "single-thread"? Otherwise, $ node cac-repro.mjs --single-thread 1 tests/file.test.ts
{
"args": [
"tests/file.test.ts"
],
"options": {
"--": [],
"singleThread": 1
}
} UPD Switching option and argument would also work, i.e. |
This issue should be fixed in 1.3.0. |
Describe the bug
When providing the
--single-thread
argument to the Vitest CLI, the presence of other arguments can mess with the way that the command line arguments are parsed.This works fine
but this gives me a complaint that
--single-thread
is necessary to use--inspect-brk
, even though it is present alreadyReproduction
https://stackblitz.com/edit/vitest-dev-vitest-brxbu1?file=package.json&initialPath=__vitest__
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: