Skip to content

Move vitest setup file to root #29097

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

Merged
merged 2 commits into from
Feb 8, 2024
Merged

Move vitest setup file to root #29097

merged 2 commits into from
Feb 8, 2024

Conversation

silverwind
Copy link
Member

I'm using this convention in other projects and I think it makes sense for gitea too because the vitest setup file is loaded globally for all tests, not just ones in web_src, so it makes sense to be in the root.

I'm using this convention in other projects and I think it makes sense
for gitea too because the vitest setup file is loaded globally for all
  tests, not just ones in web_src, so it makes sense to be in the root.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 8, 2024
@silverwind silverwind added type/refactoring Existing code has been cleaned up. There should be no new functionality. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. size/XS and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. size/XS labels Feb 8, 2024
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Feb 8, 2024

But the setup.js is for web_src only, it prepares something like window.config.

And oppositely personally I would prefer to move files away from the root directory, the root directory has been filled with a lot of various unrelated files already.

@silverwind
Copy link
Member Author

silverwind commented Feb 8, 2024

Vitest can not do different setup files for different directories with a single config file. One would have to create multiple config files to achieve that. Thought, I do prefer such files to be in root because they are easy to find.

So, not sure how to proceed. I don't really want to move vitest.config.js out of root to leave the option open to test node scripts and to enable simple npx vitest utils commands working, thought I do see it not being optimal, jsdom environment being one of the reasons.

@silverwind
Copy link
Member Author

Maybe we can compromise on web_src/js/vitest.setup.js, with such a location it's at least hierachically clear where the setup script applies.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 8, 2024
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 8, 2024
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 8, 2024
@lunny lunny merged commit 98e7e3a into go-gitea:main Feb 8, 2024
@GiteaBot GiteaBot added this to the 1.22.0 milestone Feb 8, 2024
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 8, 2024
@silverwind silverwind deleted the setupfiles branch February 8, 2024 12:11
silverwind added a commit to silverwind/gitea that referenced this pull request Feb 20, 2024
I'm using this convention in other projects and I think it makes sense
for gitea too because the vitest setup file is loaded globally for all
tests, not just ones in web_src, so it makes sense to be in the root.
6543 pushed a commit to 6543-forks/gitea that referenced this pull request Feb 26, 2024
I'm using this convention in other projects and I think it makes sense
for gitea too because the vitest setup file is loaded globally for all
tests, not just ones in web_src, so it makes sense to be in the root.

(cherry picked from commit 98e7e3a)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants