Skip to content

test: fix playground config variants #13725

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 4 commits into from
Jul 7, 2023
Merged

Conversation

patak-dev
Copy link
Member

Description

Our current test setup for config variants loaded the config files from the original playground folder instead of the playground-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.

/playground/assets/__tests__/relative_path/assets-relative-path.spec.js
/playground/assets/__tests__/relative_path/vite.config.js

But the files inside __tests__ are not copied to playground-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 to playground-temp). We were already using this convention to be able to run the playgrounds outside of Vitest. So we just needed to delete all the vite.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?

  • Bug fix
  • New Feature
  • Documentation update
  • Other
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the new convention 👍

@patak-dev patak-dev merged commit 8f109a6 into main Jul 7, 2023
@patak-dev patak-dev deleted the test/fix-custom-config-files branch July 7, 2023 11:09
sapphi-red added a commit to xinxinhe1810/vite that referenced this pull request Jul 25, 2023
The config will be loaded automatically as vitejs#13725 is merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants