Skip to content
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: fix e2e yarn berry tests #5342

Merged
merged 9 commits into from
Aug 12, 2021
Merged

chore: fix e2e yarn berry tests #5342

merged 9 commits into from
Aug 12, 2021

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Aug 11, 2021

Motivation

The Yarn 2 CI is failing for a while now and it's quite difficult to debug those Yarn 2/3 PnP-only issues.

For now, I'm reverting to node-modules linking, but would be happy to add another test with PnP mode if anyone is able to make it work.

CC @SamChou19815 in case you are interested to troubleshoot the issue. I was not able to do so (#5340).

Repro steps:

rm -rf my-website-canary

npx @docusaurus/init@canary init my-website-canary classic --skip-install

cd my-website-canary


rm -rf node_modules yarn.lock .yarn .yarnrc.yml
yarn -v

yarn set version berry
yarn -v

yarn set version 2.4.2
yarn -v

yarn config set pnpMode loose
yarn config set enableGlobalCache true

yarn install

yarn start

Apart a few deps error, the main error is:

Watchpack Error (initial scan): TypeError: Cannot destructure property 'withFileTypes' of '(intermediate value)(intermediate value)(intermediate value)' as it is null.

Unfortunately can't figure out where this comes from, and the PnP zip files do not help debug this problem.

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

ci

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Aug 11, 2021
@slorber slorber added the pr: maintenance This PR does not produce any behavior differences to end users when upgrading. label Aug 11, 2021
@netlify
Copy link

netlify bot commented Aug 11, 2021

✔️ [V2]

🔨 Explore the source changes: 8422f9a

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/61150065e5ade900074f8748

😎 Browse the preview: https://deploy-preview-5342--docusaurus-2.netlify.app

@github-actions
Copy link

github-actions bot commented Aug 11, 2021

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟢 Performance 96
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5342--docusaurus-2.netlify.app/

@github-actions
Copy link

github-actions bot commented Aug 11, 2021

Size Change: 0 B

Total Size: 793 kB

ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 36.2 kB
website/build/assets/css/styles.********.css 93.1 kB
website/build/assets/js/main.********.js 403 kB
website/build/blog/2017/12/14/introducing-docusaurus/index.html 64.2 kB
website/build/blog/index.html 33.1 kB
website/build/docs/index.html 41.9 kB
website/build/docs/installation/index.html 49.6 kB
website/build/index.html 28.7 kB
website/build/tests/docs/index.html 22.5 kB
website/build/tests/docs/standalone/index.html 20.5 kB

compressed-size-action

@SamChou19815
Copy link
Contributor

@slorber The withFileTypes error seems to be an known issue that is just fixed a few days ago, but Yarn hasn't released a new stable version yet: yarnpkg/berry#3234

Maybe we can merge this now or test with canary versions of Yarn.

yarn set version canary
yarn --version

yarn config set nodeLinker ${{ matrix.nodeLinker }}
yarn config set pnpMode loose
Copy link
Contributor

@merceyz merceyz Aug 12, 2021

Choose a reason for hiding this comment

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

Suggested change
yarn config set pnpMode loose

There are undeclared dependencies that aren't failing the test because of this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes I've seen those.
However some are:

  • mdx loader (my fault, will fix)
  • debug using supports-color (not my fault, how to fix?)
  • code copied from CRA using Node.js url. We'll likely delete this code and move back to using CRA code (which also doesn't declare url as dependency btw). Also I'm not totally sure how to fix this. Should I just add npm package url as dependency? How can I know the good version to use considering it's provided by Node.js runtime?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'd like to fix those but likely in another PR.
The goal here is just to make our existing CI pass again (which was already using loose mode)

Copy link
Contributor

Choose a reason for hiding this comment

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

debug using supports-color (not my fault, how to fix?)

Nothing to fix, it's an optional peer dependency that isn't provided by the parent so it logs an error but it's fine to ignore and wont be visible in strict mode

code copied from CRA using Node.js url. We'll likely delete this code and move back to using CRA code (which also doesn't declare url as dependency btw). Also I'm not totally sure how to fix this. Should I just add npm package url as dependency? How can I know the good version to use considering it's provided by Node.js runtime?

It's because Webpack 5 doesn't polyfill Node libraries by default, you need to do it yourself

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nothing to fix, it's an optional peer dependency that isn't provided by the parent so it logs an error but it's fine to ignore and wont be visible in strict mode

Thanks

It's because Webpack 5 doesn't polyfill Node libraries by default, you need to do it yourself

I've tried adding alias: {url: 'url'} in Webpack config but the error was still there. It's not clear to me what I should do exactly and the Medium link you gave in some yarn issue didn't make it very clear either

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see thanks, will try that.
For the mdx-loader issue, unfortunately I can't just add it because it would create a cycle in Lerna build:

lerna WARN ECYCLE @docusaurus/mdx-loader -> @docusaurus/core -> @docusaurus/mdx-loader

I see how I could re-org the code to avoid this cycle but was wondering if there's a way to just tell Yarn that the dependency is here without having to declare it in any deps? peerDependency works but is annoying because all site's parent lockfile would now have to declare @docusaurus/mdx-loader, while we know for sure it is here.

@slorber slorber changed the title chore: e2e yarn berry tests: disable pnp chore: e2e yarn berry tests Aug 12, 2021
@slorber slorber changed the title chore: e2e yarn berry tests chore: fix e2e yarn berry tests Aug 12, 2021
@slorber
Copy link
Collaborator Author

slorber commented Aug 12, 2021

Thanks all, finally fixing this annoying issue!

We'll revert to a stable release, and try to disable loose mode in the future.

As Yarn 3 is out, I don't feel like we need to have tests for Yarn 2 anymore, probably not worth it to add more 2 more CI jobs, we already have a lot

@slorber slorber merged commit ac4a253 into master Aug 12, 2021
@slorber slorber deleted the slorber/disable-pnp branch August 12, 2021 11:18
Comment on lines +79 to +80
# temporary using canary for #5342
yarn set version canary
Copy link
Contributor

Choose a reason for hiding this comment

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

We've released 3.0.1 with the fix so this can be reverted

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ohhh too late :D

anyway I don't mind staying on canary for now, I could report issues we have with it that do not happen in stable releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: maintenance This PR does not produce any behavior differences to end users when upgrading.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants