From 50aab6c8e4deed37dba300192f44f5859d3036fa Mon Sep 17 00:00:00 2001 From: Jan Kaifer Date: Wed, 23 Nov 2022 13:12:34 +0100 Subject: [PATCH 1/5] Clarify e2e dependency on yarn in contributin docs --- contributing/core/testing.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/contributing/core/testing.md b/contributing/core/testing.md index ae3e8db7bfd594b..cca7448f20c5903 100644 --- a/contributing/core/testing.md +++ b/contributing/core/testing.md @@ -33,6 +33,21 @@ 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" ``` +### Running E2E tests + +You will need `yarn` for running e2e tests. +Installing `yarn` with `corepack` is causing issues with our setup so we recommend installing it with `pnpm`: + +```sh +pnpm -g install yarn +``` + +Running e2e tests is very similar to running integration tests. Just cnahge the path to `test/e2e` like: + +```sh +pnpm testheadless test/e2e/ +``` + ## Writing tests for Next.js ### Getting Started From c6b620b36681c342a50f9335b6a5a61904f41831 Mon Sep 17 00:00:00 2001 From: Jan Kaifer Date: Wed, 23 Nov 2022 13:19:46 +0100 Subject: [PATCH 2/5] Reformulated sentence in docs due to a linter rule --- contributing/core/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing/core/testing.md b/contributing/core/testing.md index cca7448f20c5903..81519267e42b5ec 100644 --- a/contributing/core/testing.md +++ b/contributing/core/testing.md @@ -42,7 +42,7 @@ Installing `yarn` with `corepack` is causing issues with our setup so we recomme pnpm -g install yarn ``` -Running e2e tests is very similar to running integration tests. Just cnahge the path to `test/e2e` like: +e2e tests are located in `test/e2e`. You can run them like this: ```sh pnpm testheadless test/e2e/ From 93b8cbf203cf7df3e5b752361345dd053c6fa112 Mon Sep 17 00:00:00 2001 From: Jan Kaifer Date: Wed, 23 Nov 2022 16:25:26 +0100 Subject: [PATCH 3/5] Add COREPACK_ENABLE_STRICT=0 before yarn pack --- .../actions/next-stats-action/src/prepare/repo-setup.js | 7 ++++++- 1 file changed, 6 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..95ecd19f5fef611 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,12 @@ 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) + // Yarn installed through corepack will not run in pnpm project without this env var set + // This var works for corepack >=0.15.0 + await exec( + `cd ${pkgPath} && COREPACK_ENABLE_STRICT=0 yarn pack -f ${pkg}-packed.tgz`, + true + ) } return pkgPaths }, From f20bc6359262cb73c2d51506e27e9e5d961e3d69 Mon Sep 17 00:00:00 2001 From: Jan Kaifer Date: Mon, 28 Nov 2022 09:47:35 +0100 Subject: [PATCH 4/5] fixed docs --- contributing/core/testing.md | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/contributing/core/testing.md b/contributing/core/testing.md index 81519267e42b5ec..70eca377e49b7ac 100644 --- a/contributing/core/testing.md +++ b/contributing/core/testing.md @@ -33,20 +33,12 @@ 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" ``` -### Running E2E tests +**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 `yarn` with `corepack` is causing issues with our setup so we recommend installing it with `pnpm`: - -```sh -pnpm -g install yarn -``` - -e2e tests are located in `test/e2e`. You can run them like this: - -```sh -pnpm testheadless test/e2e/ -``` +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 From f66163693eec7c4d735fcd3b07c41c6810de6a3d Mon Sep 17 00:00:00 2001 From: Jan Kaifer Date: Thu, 1 Dec 2022 10:56:54 +0100 Subject: [PATCH 5/5] made yarn pack invocation work in non-bash shells --- .../next-stats-action/src/prepare/repo-setup.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 95ecd19f5fef611..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,12 +131,13 @@ module.exports = (actionInfo) => { // to the correct versions for (const pkgName of pkgDatas.keys()) { const { pkg, pkgPath } = pkgDatas.get(pkgName) - // Yarn installed through corepack will not run in pnpm project without this env var set - // This var works for corepack >=0.15.0 - await exec( - `cd ${pkgPath} && COREPACK_ENABLE_STRICT=0 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 },