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 100755 index 000000000000..4245a4b883a4 --- /dev/null +++ b/scripts/integration-tests/e2e-jest.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# 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 + +# 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="$root/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 "$root"/verdaccio-config.yml +yarn install +yarn dedupe '@babel/*' +yarn build + +# 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 +# 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 + +cleanup 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) { 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 {