Skip to content
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

feat: findRelatedTests flag, to run only changed tests #363

Merged
merged 2 commits into from Dec 29, 2021

Conversation

sheremet-va
Copy link
Member

@sheremet-va sheremet-va commented Dec 29, 2021

Related: #280

CAC allows passing array as an argument only if you repeat option, like:

vitest --findRelatedTests src/timeout.ts --findRelatedTests src/mockedA.ts

I personally think jest's way (using space as separator) is more convinient

@netlify
Copy link

netlify bot commented Dec 29, 2021

✔️ Deploy Preview for vitest-dev ready!

🔨 Explore the source changes: 37e6877

🔍 Inspect the deploy log: https://app.netlify.com/sites/vitest-dev/deploys/61cc8e4ed3293d0009064d22

😎 Browse the preview: https://deploy-preview-363--vitest-dev.netlify.app

@antfu
Copy link
Member

antfu commented Dec 29, 2021

We could use comma and split it ourselves

@sheremet-va
Copy link
Member Author

sheremet-va commented Dec 29, 2021

We could use comma and split it ourselves

Still not ideal. I like space and think we would need it in the future because */** syntax returns files separated by space. It's just natural.

@sheremet-va
Copy link
Member Author

sheremet-va commented Dec 29, 2021

Also I think most of the people using this feature have it configured the same for eslint and other tools that support passing files, and It wouldn't be convenient to redo the files array just for vitest.

@antfu
Copy link
Member

antfu commented Dec 29, 2021

idk, won't that have an ambiguous issue to distinguish from options args or command args?

@sheremet-va
Copy link
Member Author

idk, won't that have an ambiguous issue to distinguish from options args or command args?

In what way? Maybe it's harder for parser, but I think it looks more native to the human eye, no?

@sheremet-va
Copy link
Member Author

idk, won't that have an ambiguous issue to distinguish from options args or command args?

In what way? Maybe it's harder for parser, but I think it looks more native to the human eye, no?

Maybe we should ask in Discord

@antfu
Copy link
Member

antfu commented Dec 29, 2021

vite run basic
vite run --global basic
vite run --global --repoter dot basic
vite run --global --repoter dot --findRelatedTests src/timeout.ts src/mockedA.ts basic

@sheremet-va
Copy link
Member Author

sheremet-va commented Dec 29, 2021

vite run basic
vite run --global basic
vite run --global --repoter dot basic
vite run --global --repoter dot --findRelatedTests src/timeout.ts src/mockedA.ts basic

Should placing options before arguments be allowed tho?

Yargs for example can parse array of options

I think we should merge this PR as it is and discuss this separately, since it will involve cli package and maybe no one will complain 😄

@antfu antfu merged commit 2a271b5 into main Dec 29, 2021
@antfu antfu deleted the sheremet-va/add-related-tests branch December 29, 2021 16:42
JakeGinnivan pushed a commit to JakeGinnivan/vitest that referenced this pull request Jan 8, 2022
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants