test: fix playground config variants #13725
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Our current test setup for config variants loaded the config files from the original
playground
folder instead of theplayground-temp
copy. This caused issues when using__dirname
to resolve paths. I'm surprised that the tests were working. This is the issue discovered in #13712 in this comment.It worked by looking for a
vite.config.*
file in the folder of the playground variant spec.But the files inside
__tests__
are not copied toplayground-temp
.Most of these config files were a re-export of the config defined at root.
This PR defines a new convention. For variants, if there is a config named
vite.config-{variantName}.js
in root, it is then used (these are copied already toplayground-temp
). We were already using this convention to be able to run the playgrounds outside of Vitest. So we just needed to delete all thevite.config.js
files inside__tests__
(the only ones that were different were for worker sourcemap, but I reworked them... it is better because we can now run them out of tests too).What is the purpose of this pull request?