Run jest's tests in the e2e tests (#12202)

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
This commit is contained in:
Nicolò Ribaudo 2020-10-16 23:19:39 +02:00 committed by GitHub
parent 9f83b5a4df
commit 63567f0667
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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) {

View File

@ -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 {