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: add commands to run tests depending on changed files #1078

Merged
merged 6 commits into from Apr 3, 2022

Conversation

sheremet-va
Copy link
Member

@sheremet-va sheremet-va commented Apr 2, 2022

The code for getting files is based on jest implementation, but some of it was removed. Not sure how it will be working, if root and git is not the same? If someone can test in a monorepo, that would be cool. I am ashamed to admit, I am not familiar enough with git terminal commands 👀

I was testing in in tests/core by changing code in /src and it worked fine. So i guess the solution should work for most people, using git.

I am getting the changed files and putting it into related array. Then the logic for related kicks in, and it tries to find tests based on related files. I have a guard if (!related) { // find related } in case runTests runs twice (bc of watch mode or else)

@netlify
Copy link

netlify bot commented Apr 2, 2022

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit c83aa58
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/6249324222850d000853a005
😎 Deploy Preview https://deploy-preview-1078--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@sheremet-va
Copy link
Member Author

Don't know how to write tests for this :S

Maybe by mocking exec? But all it does is call it, so what would be the point 🤔

@sheremet-va sheremet-va requested a review from antfu April 2, 2022 13:07
@sheremet-va sheremet-va requested a review from antfu April 3, 2022 05:38
@antfu antfu merged commit 3c965d4 into vitest-dev:main Apr 3, 2022
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