From 367a5df546e12629492f737bb63b7b0129cdc6b6 Mon Sep 17 00:00:00 2001 From: Jan Kaifer Date: Fri, 9 Dec 2022 13:34:32 +0100 Subject: [PATCH] Clarify e2e dependency on yarn in contributin docs (#43287) `yarn` installed with `corepack` won't run in our repo because it is configured as a `pnpm` project. `yarn` binaries installed from other sources don't care. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md) ## Documentation / Examples - [x] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) --- .../actions/next-stats-action/src/prepare/repo-setup.js | 8 +++++++- contributing/core/testing.md | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/actions/next-stats-action/src/prepare/repo-setup.js b/.github/actions/next-stats-action/src/prepare/repo-setup.js index 1ff98843f197fb2..493644727d6ec98 100644 --- a/.github/actions/next-stats-action/src/prepare/repo-setup.js +++ b/.github/actions/next-stats-action/src/prepare/repo-setup.js @@ -131,7 +131,13 @@ module.exports = (actionInfo) => { // to the correct versions for (const pkgName of pkgDatas.keys()) { const { pkg, pkgPath } = pkgDatas.get(pkgName) - await exec(`cd ${pkgPath} && yarn pack -f ${pkg}-packed.tgz`, true) + await exec(`cd ${pkgPath} && yarn pack -f ${pkg}-packed.tgz`, true, { + env: { + // Yarn installed through corepack will not run in pnpm project without this env var set + // This var works for corepack >=0.15.0 + COREPACK_ENABLE_STRICT: '0', + }, + }) } return pkgPaths }, diff --git a/contributing/core/testing.md b/contributing/core/testing.md index ae3e8db7bfd594b..70eca377e49b7ac 100644 --- a/contributing/core/testing.md +++ b/contributing/core/testing.md @@ -33,6 +33,13 @@ When the test runs it will open the browser that is in the background by default pnpm testonly test/integration/production/ -t "should allow etag header support" ``` +**End-to-end (e2e)** tests are run in complete isolation from the repository. +When you run an e2e test, a local version of next will be created inside your system's temp folder (eg. /tmp), +which is then linked to the app, also created inside a temp folder. A server is started on a random port, against which the tests will run. +After all tests have finished, the server is destroyed and all remaining files are deleted from the temp folder. + +You will need `yarn` for running e2e tests. Installing it `corepack` won't work because `next.js` is `pnpm` workspace. + ## Writing tests for Next.js ### Getting Started