From 53612329d212c450ee762568b84408d8e4266586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 16 Oct 2020 15:03:58 +0200 Subject: [PATCH 01/13] Run jest't tests in the e2e tests --- .circleci/config.yml | 11 +++++++ scripts/integration-tests/e2e-jest.sh | 46 +++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 scripts/integration-tests/e2e-jest.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index a4700f075ac1..bfe138f473c5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -153,6 +153,14 @@ jobs: at: /tmp/verdaccio-workspace - run: ./scripts/integration-tests/e2e-vue-cli.sh + e2e-jest: + executor: node-executor + steps: + - checkout + - attach_workspace: + at: /tmp/verdaccio-workspace + - run: ./scripts/integration-tests/e2e-jest.sh + workflows: version: 2 build-standalone: @@ -203,3 +211,6 @@ workflows: - e2e-vue-cli: requires: - publish-verdaccio + - e2e-jest: + requires: + - publish-verdaccio diff --git a/scripts/integration-tests/e2e-jest.sh b/scripts/integration-tests/e2e-jest.sh new file mode 100644 index 000000000000..70e921d7146f --- /dev/null +++ b/scripts/integration-tests/e2e-jest.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# Start in scripts/integration-tests/ even if run from root directory +cd "$(dirname "$0")" || exit + +source utils/local-registry.sh +source utils/cleanup.sh + +# Echo every command being executed +set -x + +# Clone jest +git clone --depth=1 https://github.com/facebook/jest tmp/jest +cd tmp/jest || exit + +# Update @babel/* dependencies +bump_deps="$PWD/../../utils/bump-babel-dependencies.js" +node "$bump_deps" +for d in ./packages/*/ +do + (cd "$d"; node "$bump_deps") +done + +#==============================================================================# +# ENVIRONMENT # +#==============================================================================# +node -v +yarn --version +python --version + +#==============================================================================# +# TEST # +#==============================================================================# + +startLocalRegistry "$PWD"/../../verdaccio-config.yml +yarn install +yarn build + +# Test +CI=true yarn test + +cleanup From ba64350602a76f2c64545218194b2d06dd5d9640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 16 Oct 2020 15:17:50 +0200 Subject: [PATCH 02/13] Fix permission --- scripts/integration-tests/e2e-jest.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/integration-tests/e2e-jest.sh diff --git a/scripts/integration-tests/e2e-jest.sh b/scripts/integration-tests/e2e-jest.sh old mode 100644 new mode 100755 From bf20a348082267d0e0d9e05e0aa43c04b6913269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 16 Oct 2020 15:27:16 +0200 Subject: [PATCH 03/13] Use "*" in peerDependencies rather than "latest" --- .../integration-tests/utils/bump-babel-dependencies.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/integration-tests/utils/bump-babel-dependencies.js b/scripts/integration-tests/utils/bump-babel-dependencies.js index a0d4aa0eccf5..f7509dcf6335 100644 --- a/scripts/integration-tests/utils/bump-babel-dependencies.js +++ b/scripts/integration-tests/utils/bump-babel-dependencies.js @@ -5,23 +5,23 @@ const packageJSONPath = path.resolve(cwd, "./package.json"); const content = JSON.parse(fs.readFileSync(packageJSONPath)); let bumped = false; -function bumpBabelDependency(dependencies) { +function bumpBabelDependency(dependencies, version) { for (const dep of Object.keys(dependencies)) { if (dep.startsWith("@babel/") && !dependencies[dep].includes(":")) { - dependencies[dep] = "latest"; + dependencies[dep] = version; bumped = true; } } } if ("peerDependencies" in content) { - bumpBabelDependency(content.peerDependencies); + bumpBabelDependency(content.peerDependencies, "*"); } if ("devDependencies" in content) { - bumpBabelDependency(content.devDependencies); + bumpBabelDependency(content.devDependencies, "latest"); } if ("dependencies" in content) { - bumpBabelDependency(content.dependencies); + bumpBabelDependency(content.dependencies, "latest"); } if (bumped) { From 949563715ffa628e9e44880d123a5fd164c96064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 16 Oct 2020 15:49:07 +0200 Subject: [PATCH 04/13] Move to /tmp to prevent yarn from merging jest's .yarnrc.yml with ours --- scripts/integration-tests/e2e-jest.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/integration-tests/e2e-jest.sh b/scripts/integration-tests/e2e-jest.sh index 70e921d7146f..fa74b5802d28 100755 --- a/scripts/integration-tests/e2e-jest.sh +++ b/scripts/integration-tests/e2e-jest.sh @@ -6,6 +6,7 @@ # Start in scripts/integration-tests/ even if run from root directory cd "$(dirname "$0")" || exit +root="$PWD" source utils/local-registry.sh source utils/cleanup.sh @@ -14,11 +15,11 @@ source utils/cleanup.sh set -x # Clone jest -git clone --depth=1 https://github.com/facebook/jest tmp/jest -cd tmp/jest || exit +git clone --depth=1 https://github.com/facebook/jest /tmp/jest +cd /tmp/jest || exit # Update @babel/* dependencies -bump_deps="$PWD/../../utils/bump-babel-dependencies.js" +bump_deps="$root/utils/bump-babel-dependencies.js" node "$bump_deps" for d in ./packages/*/ do @@ -36,7 +37,7 @@ python --version # TEST # #==============================================================================# -startLocalRegistry "$PWD"/../../verdaccio-config.yml +startLocalRegistry "$root"/verdaccio-config.yml yarn install yarn build From f3945f77932acdbb1e9f042e85f545024dab47b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 16 Oct 2020 16:04:26 +0200 Subject: [PATCH 05/13] Update --- scripts/integration-tests/utils/local-registry.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/integration-tests/utils/local-registry.sh b/scripts/integration-tests/utils/local-registry.sh index 8b85018a947b..68b88f37f596 100755 --- a/scripts/integration-tests/utils/local-registry.sh +++ b/scripts/integration-tests/utils/local-registry.sh @@ -19,6 +19,7 @@ function startLocalRegistry { export YARN_NPM_PUBLISH_REGISTRY="$custom_registry_url" export YARN_NPM_REGISTRY_SERVER="$custom_registry_url" export YARN_NPM_AUTH_IDENT="username:password" + export YARN_UNSAFE_HTTP_WHITELIST="localhost" } function loginLocalRegistry { From 19d1979a89bea12ee947ebf8607a27d67c89e127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 16 Oct 2020 16:15:59 +0200 Subject: [PATCH 06/13] Skip .d.ts build since it's failing --- scripts/integration-tests/e2e-jest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/integration-tests/e2e-jest.sh b/scripts/integration-tests/e2e-jest.sh index fa74b5802d28..3b9d3e54eba6 100755 --- a/scripts/integration-tests/e2e-jest.sh +++ b/scripts/integration-tests/e2e-jest.sh @@ -39,7 +39,7 @@ python --version startLocalRegistry "$root"/verdaccio-config.yml yarn install -yarn build +yarn build:js # Test CI=true yarn test From 57aeb03cec60e02c75ffe897991850dd1f30dc27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 16 Oct 2020 16:40:18 +0200 Subject: [PATCH 07/13] Dedupe @babel/types deps --- scripts/integration-tests/e2e-jest.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/integration-tests/e2e-jest.sh b/scripts/integration-tests/e2e-jest.sh index 3b9d3e54eba6..31034b503b34 100755 --- a/scripts/integration-tests/e2e-jest.sh +++ b/scripts/integration-tests/e2e-jest.sh @@ -39,7 +39,8 @@ python --version startLocalRegistry "$root"/verdaccio-config.yml yarn install -yarn build:js +yarn dedupe +yarn build # Test CI=true yarn test From d7c56d069fb9ef3a83ed7996c4b65db6cba9116f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 16 Oct 2020 16:56:28 +0200 Subject: [PATCH 08/13] Don't fail for type errors --- scripts/integration-tests/e2e-jest.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/integration-tests/e2e-jest.sh b/scripts/integration-tests/e2e-jest.sh index 31034b503b34..efd5773433cf 100755 --- a/scripts/integration-tests/e2e-jest.sh +++ b/scripts/integration-tests/e2e-jest.sh @@ -40,7 +40,10 @@ python --version startLocalRegistry "$root"/verdaccio-config.yml yarn install yarn dedupe -yarn build +yarn build:js +# "yarn build" is "yarn build:js && yarn build:ts", but we can still run +# "yarn test" if "yarn build:ts" fails +yarn build:ts || echo "" # Test CI=true yarn test From b1d9aac9c4cba52380402c3414b4efc0e0590710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 16 Oct 2020 17:08:06 +0200 Subject: [PATCH 09/13] Only dedupe babel deps --- scripts/integration-tests/e2e-jest.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/integration-tests/e2e-jest.sh b/scripts/integration-tests/e2e-jest.sh index efd5773433cf..67d28fba2d30 100755 --- a/scripts/integration-tests/e2e-jest.sh +++ b/scripts/integration-tests/e2e-jest.sh @@ -39,11 +39,8 @@ python --version startLocalRegistry "$root"/verdaccio-config.yml yarn install -yarn dedupe -yarn build:js -# "yarn build" is "yarn build:js && yarn build:ts", but we can still run -# "yarn test" if "yarn build:ts" fails -yarn build:ts || echo "" +yarn dedupe '@babel/*' +yarn build # Test CI=true yarn test From 086a109161413bbe162bc6e4ca4fefb46ec5f8e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 16 Oct 2020 17:23:38 +0200 Subject: [PATCH 10/13] Run corrects tests --- scripts/integration-tests/e2e-jest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/integration-tests/e2e-jest.sh b/scripts/integration-tests/e2e-jest.sh index 67d28fba2d30..702f329b4b5d 100755 --- a/scripts/integration-tests/e2e-jest.sh +++ b/scripts/integration-tests/e2e-jest.sh @@ -43,6 +43,6 @@ yarn dedupe '@babel/*' yarn build # Test -CI=true yarn test +CI=true yarn test-ci-partial cleanup From cc33298f98cb956028bdfaaea14ced14faa46ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 16 Oct 2020 22:46:46 +0200 Subject: [PATCH 11/13] Only run some tests --- scripts/integration-tests/e2e-jest.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/integration-tests/e2e-jest.sh b/scripts/integration-tests/e2e-jest.sh index 702f329b4b5d..94b8d316ba8b 100755 --- a/scripts/integration-tests/e2e-jest.sh +++ b/scripts/integration-tests/e2e-jest.sh @@ -42,7 +42,13 @@ yarn install yarn dedupe '@babel/*' yarn build -# Test -CI=true yarn test-ci-partial +# The full test suite take about 20mins on CircleCI. We run only a few of them +# to speed it up. +# The goals of this e2e test are: +# 1) Check that the typescript compilation isn't completely broken +# 2) Make sure that we don't accidentally break jest's usage or the Babel API +CI=true yarn test-ci-partial packages +CI=true yarn test-ci-partial e2e/__tests__/babel +CI=true yarn test-ci-partial e2e/__tests__/transform cleanup From 11f58c8b262c33dd5c1d10a07f89b0957b24cc91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 16 Oct 2020 22:49:52 +0200 Subject: [PATCH 12/13] Update scripts/integration-tests/e2e-jest.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Huáng Jùnliàng --- scripts/integration-tests/e2e-jest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/integration-tests/e2e-jest.sh b/scripts/integration-tests/e2e-jest.sh index 94b8d316ba8b..a4451ec0a535 100755 --- a/scripts/integration-tests/e2e-jest.sh +++ b/scripts/integration-tests/e2e-jest.sh @@ -46,7 +46,7 @@ yarn build # to speed it up. # The goals of this e2e test are: # 1) Check that the typescript compilation isn't completely broken -# 2) Make sure that we don't accidentally break jest's usage or the Babel API +# 2) Make sure that we don't accidentally break jest's usage of the Babel API CI=true yarn test-ci-partial packages CI=true yarn test-ci-partial e2e/__tests__/babel CI=true yarn test-ci-partial e2e/__tests__/transform From 1e40b57c77b0c15209e0b06b27ae1e5d779a676a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 16 Oct 2020 22:50:25 +0200 Subject: [PATCH 13/13] Update scripts/integration-tests/e2e-jest.sh --- scripts/integration-tests/e2e-jest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/integration-tests/e2e-jest.sh b/scripts/integration-tests/e2e-jest.sh index a4451ec0a535..4245a4b883a4 100755 --- a/scripts/integration-tests/e2e-jest.sh +++ b/scripts/integration-tests/e2e-jest.sh @@ -42,7 +42,7 @@ yarn install yarn dedupe '@babel/*' yarn build -# The full test suite take about 20mins on CircleCI. We run only a few of them +# The full test suite takes about 20mins on CircleCI. We run only a few of them # to speed it up. # The goals of this e2e test are: # 1) Check that the typescript compilation isn't completely broken