refactor: add CLI config schema to make sure we don't miss options#5126
refactor: add CLI config schema to make sure we don't miss options#5126sheremet-va merged 16 commits intovitest-dev:mainfrom
Conversation
✅ Deploy Preview for fastidious-cascaron-4ded94 canceled.
|
AriPerkkio
left a comment
There was a problem hiding this comment.
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
AriPerkkio
left a comment
There was a problem hiding this comment.
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ö <[email protected]>
Ah, yes. This only happens with |
AriPerkkio
left a comment
There was a problem hiding this comment.
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.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.