New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run jest's tests in the e2e tests #12202
Changes from all commits
5361232
ba64350
bf20a34
9495637
f3945f7
19d1979
57aeb03
d7c56d0
b1d9aac
086a109
cc33298
11f58c8
1e40b57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, "*"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or we can simply remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will cause problems if one of the packages we test starts using PnP 😛 |
||
} | ||
if ("devDependencies" in content) { | ||
bumpBabelDependency(content.devDependencies); | ||
bumpBabelDependency(content.devDependencies, "latest"); | ||
} | ||
if ("dependencies" in content) { | ||
bumpBabelDependency(content.dependencies); | ||
bumpBabelDependency(content.dependencies, "latest"); | ||
} | ||
|
||
if (bumped) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could do
yarn test-ci-partial --ci packages e2e/__tests__/babel e2e/__tests__/transform
?FWIW I just landed jestjs/jest#10653 which adds
test-ci-partial:parallel
(which just removes the-i
argument) so if you have multiple cores available on CI you can speed it up.yarn test-ci-partial:parallel --ci --max-workers $(nproc) packages e2e/__tests__/babel e2e/__tests__/transform
or something like that