diff --git a/.buildkite/pipelines/hourly.yml b/.buildkite/pipelines/hourly.yml index 3337cfb5dfcdd7d..9c8dd350a6556e4 100644 --- a/.buildkite/pipelines/hourly.yml +++ b/.buildkite/pipelines/hourly.yml @@ -135,8 +135,9 @@ steps: - command: .buildkite/scripts/steps/test/jest.sh label: 'Jest Tests' + parallelism: 5 agents: - queue: c2-16 + queue: n2-4 timeout_in_minutes: 120 key: jest diff --git a/.buildkite/pipelines/pull_request/base.yml b/.buildkite/pipelines/pull_request/base.yml index 1013a841dfd271b..427e2d5766d1b89 100644 --- a/.buildkite/pipelines/pull_request/base.yml +++ b/.buildkite/pipelines/pull_request/base.yml @@ -133,8 +133,9 @@ steps: - command: .buildkite/scripts/steps/test/jest.sh label: 'Jest Tests' + parallelism: 5 agents: - queue: c2-16 + queue: n2-4 timeout_in_minutes: 120 key: jest diff --git a/.buildkite/scripts/steps/test/jest.sh b/.buildkite/scripts/steps/test/jest.sh index 2c4e3fe21902d07..d2d1ed10043d6b5 100755 --- a/.buildkite/scripts/steps/test/jest.sh +++ b/.buildkite/scripts/steps/test/jest.sh @@ -9,5 +9,5 @@ is_test_execution_step .buildkite/scripts/bootstrap.sh echo '--- Jest' -checks-reporter-with-killswitch "Jest Unit Tests" \ - node scripts/jest --ci --verbose --maxWorkers=10 +checks-reporter-with-killswitch "Jest Unit Tests $((BUILDKITE_PARALLEL_JOB+1))" \ + .buildkite/scripts/steps/test/jest_parallel.sh diff --git a/.buildkite/scripts/steps/test/jest_parallel.sh b/.buildkite/scripts/steps/test/jest_parallel.sh new file mode 100755 index 000000000000000..739aaa4987dc092 --- /dev/null +++ b/.buildkite/scripts/steps/test/jest_parallel.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -euo pipefail + +JOB=$BUILDKITE_PARALLEL_JOB +JOB_COUNT=$BUILDKITE_PARALLEL_JOB_COUNT + +i=0 +find src x-pack packages -name jest.config.js | sort | while read config; do + if [ "$(($i % $JOB_COUNT))" -eq $JOB ]; then + echo "--- $ node scripts/jest --config $config" + node scripts/jest --config $config --runInBand + fi + + ((i=i+1)) +done