Berry: ๐Ÿ›  Help write E2E Tests!

Created on 20 Aug 2019  ยท  20Comments  ยท  Source: yarnpkg/berry

Followup to #275

In order to ensure that Yarn 2 is in a good state to be released, we first need to have tests ensuring our compatibility with the ecosystem that relies on us. To this end, we will need to write end-to-end tests for the following framework / libraries. Anyone is welcome to help for any number of those tools (note that some are known working - but we want to automate this check to prevent regressions):

Frameworks:

Tools:

  • [x] ESLint
  • [ ] Gulp
  • [x] Husky
  • [x] Jest
  • [x] Mocha
  • [x] Parcel 2
  • [x] Prettier
  • [x] Rollup
  • [x] TypeScript
  • [x] Webpack 5

Methodology:

Anyone willing to lend us a hand can prepare a bash script that automatically installs one of those tools and check its behaviour somehow. Open a new issue to share it, and link it to this very issue. For example, here's a basic script that would test that Gatsby can build (we probably should expand it a bit):

# The `| cat` aims to workaround this request:
# https://github.com/gatsbyjs/gatsby/blob/99fb7b44810d658805211073ddfc18e508b57c87/packages/gatsby-cli/src/init-starter.js#L40
yarn dlx gatsby new my-gatsby | cat
cd my-gatsby
yarn build

Once done, copy one of the preexisting e2e workflows (in .github/workflows), put your testcase there, then open an PR!

If something doesn't work:

It's quite likely that some things don't work, for a reason or another. If that happens:

  • First try to see whether it's caused by a package not depending on another. Yarn will tell you if it thinks it's the case.

  • If Yarn doesn't tell you anything but you get a "module not found" error or similar, use the PNP_DEBUG_LEVEL=1 (or 2 for all the calls, whether they succeed or not) environment variable to get more insight as to what's failing in the resolution.

  • If an error tells you that your own package is trying to require a package without listing it, and if you're sure that no, you're definitely not requiring this package, then something is probably passing an unresolved plugin name to something else (typically this could be a Webpack loader, or a Babel plugin).

In any of those cases, please open a PR in the relevant repository and link it here so that we can track them. Also ping me so that I can get the discussion by mail (I likely won't answer unless needed, but it's useful to get a better idea of how fast we progress).

enhancement help wanted

Most helpful comment

I love this table ๐Ÿ˜

image

All 20 comments

FYI, NextJS is currently blocked by a missing dependency. @deini already made the PR. :)

I love this table ๐Ÿ˜

image

I noticed that react-native and metro bundler are not on the list. Is that intentional? :)

If we get someone to look at it I'd be happy to add them, I'm just sure I won't have the bandwidth to do it myself if it comes to that (I've never made RN development myself), so I don't want to make it a blocker.

Metro should already have most of the basic blocks, the problem is mainly the RN toolchain. Cf https://github.com/react-native-community/cli/issues/27

Understood. I saw your message about metro support a while back and just
assumed rn wasnโ€™t far away.

I do a little rn dev and might be able to help. It makes sense to focus on
these ones first, though. :thumbsup:

On Tue, 27 Aug 2019 at 4:36 pm, Maรซl Nison notifications@github.com wrote:

If we get someone to look at it I'd be happy to add them, I'm just sure I
won't have the bandwidth to do it myself if it comes to that (I've never
made RN development myself), so I don't want to make it a blocker.

Metro should already have most of the basic blocks, the problem is mainly
the RN toolchain. Cf react-native-community/cli#27
https://github.com/react-native-community/cli/issues/27

โ€”
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/yarnpkg/berry/issues/368?email_source=notifications&email_token=AA6EMZJ52G5WD7XSTY3HQMTQGTDNPA5CNFSM4INWZZAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5GVATA#issuecomment-525160524,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA6EMZPKOR5QBX2DSMB4UTTQGTDNPANCNFSM4INWZZAA
.

Got next working with minimal pages/config: https://github.com/eps1lon/berry-next. Working on a PR to next and then expanding the example.

Parcel 2 Alpha is out but arcanis's pr didn't make it in yet. Parcel 2 e2e tests are blocked until these changes make it to the parcel alpha.

@willgriffiths my PR was on Parcel 1, unfortunately. I made a quick experiment with Parcel 2, and on the top of my head the main problem was https://github.com/nodejs/node/issues/29117 (I haven't had time to double-check yet), which required to disable the threading backend. There also were other issues but Parcel was eating the exceptions, so I couldn't see them very well ๐Ÿ™

I'm looking into writing a test for webpack 5. Are there any specific features or plugins/loaders that it would be good to test? Or if it works for one it should work for every?

There are some examples here: https://github.com/webpack/webpack/tree/master/examples

Awesome! If possible, I'd suggest to test thread-loader, less-loader, sass-loader, and ts-loader, as they are the most likely ones to require a bit of plumbing.

I know that ts-loader requires ts-pnp at the moment, but its maintainer is super nice and would be happy to merge a PR to make it supported out of the box (just saying this to give some context; it should not be a blocker for your PR ๐Ÿ˜Š).

Cool. I'll have a hack and see how far I can get. :)

Before i forget, here's the write-up about Vue's situation that @lbogdan wrote a few weeks ago:

https://gist.github.com/lbogdan/b8c652e6fd6f906492e0adf0ee044c82

A little update on the webpack e2e tests.

Theres a bug in compatibility with webpack-cli and webpack 5.
https://github.com/webpack/webpack-cli/issues/1023
https://github.com/webpack/webpack-cli/pull/1065

After unplugging and applying the fix in the pr it builds a basic project. Now I'm working on less-loader.

I remember @deini mentioned a fix was needed for Next.js - they seem to have released the 9.0.6-canary.0, we should check it works with Yarn!

I've unchecked next since react requiring a singleton renderer for hooks to work needs either special config attention or attention within yarn. I'm just starting to look into this issue.

@eps1lon I fixed that in Next master, but it hasn't been released yet ๐Ÿ˜ƒ

Bug: https://github.com/zeit/next.js/issues/8659
PR: https://github.com/zeit/next.js/pull/8668

@eps1lon I fixed that in Next master, but it hasn't been released yet

Bug: zeit/next.js#8659
PR: zeit/next.js#8668

Looks like it :+1: Monkey patched it and after some undeclared dependency errors I got it to work: https://github.com/eps1lon/berry-next/commit/239a738364e9578948909ec8243624523f36e289

It seem Nuxt doesn't work if the project is already initialized with npm. @nuxt/whatever is not installed.

@arcanis, I apologize for accidentally editing your comment. I accidentally clicked on the Nuxt checkbox without knowing that it would edit it. I reverted my change. Now I might as well look into adding a test for Nuxt ๐Ÿ˜„

Should babel be on this list?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mike-Dax picture Mike-Dax  ยท  3Comments

bradleyayers picture bradleyayers  ยท  3Comments

kiprasmel picture kiprasmel  ยท  3Comments

Bessonov picture Bessonov  ยท  4Comments

wojtekmaj picture wojtekmaj  ยท  3Comments