-
-
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
refactor: add CLI config schema to make sure we don't miss options #5126
Conversation
✅ Deploy Preview for fastidious-cascaron-4ded94 canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks really nice. 🙌
I think this is a solution that we can maintain quite easily. I'm glad to see the --someOption --someOption.nestedOption=value
working without specifying the .enabled
explicitly.
Some quick comments below for now. I'll do proper review later this week and do some manual testing.
5af0381
to
73a8b41
Compare
d562f03
to
f308321
Compare
f308321
to
f612041
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to make sure we didn't forget to add a CLI option because it requires an explicit opt-out.
This seems to work for top-level configurations, but not for sub-commands.
I have not yet finished reviewing this completely, but I'm confident enough about the changes. Feel free to merge this if needed. I'll look into this more later this week once I find some time.
Can you give an example when this doesn't work? If I remove any nested commands, I get a type error. |
I tested this by adding new option to provider specific coverage options. But when I add an option to all providers, then it raises an error on CLI definitions. So it's got something to do with conditional types. Detecting all those combinations might be difficult so the current implementation is enough I think. |
Co-authored-by: Ari Perkkiö <ari.perkkio@gmail.com>
Ah, yes. This only happens with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks! Also thanks to @LorenzoBloedow for earlier work on #3983! 🙌
No problem, glad you guys found a solution! If you need any help feel free to hit me up on Twitter! |
This broke It doesn't find test cases to run. When this commit is reverted all works fine. vitest/packages/vitest/src/node/cli/cac.ts Lines 170 to 172 in 4e17942
$ pnpm test
> @vitest-tests/browser-simple@ test /z/y/x/browser-simple
> vitest --browser=firefox
{
filters: [ 'firefox' ],
options: { '--': [], color: true, browser: { enabled: true } }
} |
Description
This PR makes it easier for us to make sure we didn't forget to add a CLI option because it requires an explicit opt-out.
This is also a continuation of #3983 to make sure all types are correct.
Closes #3983
Fixes #3962
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.