Conversation
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
delucis
left a comment
There was a problem hiding this comment.
Amazingly thorough investigation and documentation of the fix @HiDeoo! This all makes sense to me and I’m happy to go with this approach as you suggested.
One question: do you think it makes most sense to merge this into the MDX v3 branch or is it better to target main and then I can rebase the MDX v3 branch on top of these changes?
I initially targeted the MDX v3 branch as it's the one that needed the Vitest update (due to Vite 5.1 changes with the Astro bump) but technically, I guess this could also makes sense to target |
|
Let's target |
|
This should be good, also pushed an empty commits to re-run all the workflows as I think there is still no event so that the workflows can be triggered after the base branch change. |
This PR is targetting #1846.Description
This PR updates the Vitest version used in the monorepo to the latest version instead of the initial
1.4.0bump due to a test failure.Why was this test failing when upgrading to at least Vitest
1.5.0?1.5.0introduced a change to the workspace feature current working directory (cwd) making it the config directory.1.4.0, the current working directory would bepackages/starlight/1.5.0, the current working directory would bepackages/starlight/__tests__/i18n-non-root-single-locale/for thei18n-non-root-single-localetest suite.getViteConfig()which will internally callresolveConfig()which callsresolveRoot()with anundefinedargument which would end up usingprocess.cwd().packages/starlight/__tests__/i18n-non-root-single-locale/as the root,packages/starlight/__tests__/i18n-non-root-single-locale/src/content/i18n/fr.jsonwould be automatically loaded when we callgetCollection()which was not the case before.Why is only the
i18n-non-root-single-localetest suite failing and not thei18ntest suite which uses a similar setup?i18ntest suite is not impacted because the default locale isenbut is configured with alangusing a regional subtag (en-US) which means the user config overrides needs to be in foren-USand thus not being impacted byen.jsonbeing loaded.How is this PR fixing the issue?
i18n-non-root-single-localetest suite to use thefr-CAfor thelangof the default locale to use the same setup as thei18ntest suite.What alternatives were considered?
getViteConfig()new second argument to specify therootin the inline Astro config to fallback to the previous behavior and avoid usingprocess.cwd()but I think this is wrong to just assume the CWD is not the root of the test suite.packages/starlight/__tests__/i18n-non-root-single-locale/translations-fs.test.tsto another dedicated suite (where we do not mix real CC files and CC mocking). I think this is a valid one but we would need I think to do the same for thei18ntest suite which is not failing. I think it's better to have a consistent setup for all the test suites but I'm open to feedback on this.Why are the
.gitignorechanges in this PR required?By Astro now using the proper root, and
getViteConfig()somehow triggering someting close toastro sync, we end up with all the extra files in each test suites instead of justpackages/starlight/like before when this folder was considered the CWD.