-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
chore(v2): Add E2E test for yarn v2 #3008
Conversation
Deploy preview for docusaurus-2 ready! Built with commit 1fa41be |
The purpose of e2e test is to ensure that the docusaurus inited website can stand on its own. The root node_modules remain accessible according to how node resolution works and it might interfere with the test. Remove them for safety.
.github/workflows/e2e-test.yml
Outdated
yarn config set npmRegistryServer http://localhost:4873 | ||
yarn config set unsafeHttpWhitelist --json '["localhost"]' | ||
yarn install | ||
yarn add @mdx-js/react |
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.
wonder what's the purpose of adding mdx react here?
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.
Some docusaurus client code injects import '@mdx-js/react'
on user's behalf, so it appears to yarn that user's project requires this dependency, not docusaurus. Therefore, user's package.json must declare this dependency otherwise yarn v2 cannot resolve it.
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.
wouldn't it be better to include the dependency on the init template directly? because this might affect yarn 2 users using the init template too no?
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.
done
Not very familar with yarn 2 but LGTM |
Btw, seems related but we should reenable the eslint Also, I tried to install this tool that worked great on another monorepo, but my short attempt was not so great (unfortunately, it's not very configurable so you need to conform to all the checks apparently). If you are interested to give it another try: https://github.com/Thinkmill/manypkg |
LGTM |
Motivation
It's very easy for us to miss some dependencies and not caught by CI, because Yarn workspace is very loose: as long as you define a dependency in package A, you can access it in package B locally since Yarn workspace try to put as many dependencies into the root
node_modules
as possible. Therefore, we might frequently need bug fixes like #3007 for Yarn v2 when these problems are found after a new release.This PR tries to solve the undetectable missing dependency problem by setup an E2E test for Yarn v2. Currently, it can only pass in pnp loose mode since some of our dependencies don't properly declare their dependencies. However, we can still see the warnings printed in the log so it can guide us to fix these problems upstream in the future.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
CI passes.
Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)