-
Notifications
You must be signed in to change notification settings - Fork 186
chore(js): Remove misleading top-level Vitest configuration #20234
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
base: edge
Are you sure you want to change the base?
chore(js): Remove misleading top-level Vitest configuration #20234
Conversation
vitest.config.mts was its only consumer.
mjhuff
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the writeup. This makes sense to me with the test plan, thank you!
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## edge #20234 +/- ##
==========================================
- Coverage 26.02% 24.28% -1.74%
==========================================
Files 3627 3621 -6
Lines 301690 301119 -571
Branches 42198 42126 -72
==========================================
- Hits 78500 73114 -5386
- Misses 223168 227985 +4817
+ Partials 22 20 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
|
Resolve conflicts in: * storybook/main.ts * vitest.config.mts
|
|
||
| async viteFinal(config) { | ||
| config.resolve = config.resolve || {} | ||
| config.resolve.alias = config.resolve.alias || {} | ||
|
|
||
| // Add the same alias as in app/vite.config.mts to support /app/ imports | ||
| config.resolve.alias['/app/'] = path.resolve(__dirname, '../app/src/') + '/' | ||
|
|
||
| return config | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // todo(mm, 2025-11-25): This is meant to allow loading images in e.g. | ||
| // DeckFixtureSetupInstructionsModal, but it doesn't seem to be working. | ||
| staticDirs: ['../app/src/assets'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh wait, it's working in the sandbox link but it's not working with make -C components dev. That's weird.
mjhuff
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, happy with where this ended up all things considered. The eventual goal of project-local config files sounds good to me.
…lete_the_test_viteconfigs Resolve conflicts in: * .github/workflows/ll-test-build-deploy.yaml * .github/workflows/pd-test-build-deploy.yaml
Overview
This is a simplification to our JS toolchain configuration.
Details
For what I suspect are accidental/historical reasons, our Vite and Vitest config has been working like this:
flowchart BT global_vite["top-level vite.config.mts"] global_vitest["top-level vitest.config.mts"] global_vitest -- "imports and merges with" --> global_vite app protocol-designer components etc["etc..."] app app -- "main config" --> app_vite["app/vite.config.mts"] app -- "test config" --> global_vitest protocol-designer protocol-designer -- "main config" --> protocol_designer_vite["protocol-designer/vite.config.mts"] protocol-designer -- "test config" --> global_vitest components components -- "test config" --> global_vitest components -- "main config" --> components_vite["components/vite.config.mts"] storybook -- "main config" --> global_vite etc["etc..."]Each project had its main Vite configuration in a local vite.config.mts file.
We also had a global vite.config.mts file. Confusingly, it wasn't involved in any project's configuration. It was used by Storybook, and, indirectly, by Vitest.
Changelog
This PR doesn't fully resolve the mismatch between how Vitest+Storybook are configured globally, whereas the project themselves are configured locally. (In my opinion, we ought to go fully local, but I haven't achieved that here.)
What this PR does do is do away with the global vite.config.mts file. For Vitest, it's replaced by vitest.config.mts, which already existed; stuff was essentially split up arbitrarily between the two. For Storybook, it's replaced by a new .storybook/vite.config.mts. I think these are improvements because they make it clearer what the files actually affect.
So we end up with:
flowchart BT global_vitest["top-level vitest.config.mts"] app protocol-designer components etc["etc..."] app app -- "main config" --> app_vite["app/vite.config.mts"] app -- "test config" --> global_vitest protocol-designer protocol-designer -- "main config" --> protocol_designer_vite["protocol-designer/vite.config.mts"] protocol-designer -- "test config" --> global_vitest components components -- "test config" --> global_vitest components -- "main config" --> components_vite["components/vite.config.mts"] storybook -- "main config" --> storybook_vite[".storybook/vite.config.mts"] etc["etc..."]Test Plan and Hands on Testing
make devcommandsmake -C app devmake -C components devmake -C protocol-designer devReview requests
None in particular. I guess just, does this direction for simplification sound good? Incrementally simplify this for now, and eventually move everything to project-local config files?
Risk assessment
Medium. Things will totally break (and not be caught by tests) if I've gotten this wrong and any of the JS projects are relying on the global vite.config.mts file.