diff --git a/.buildkite/scripts/steps/test/jest_parallel.sh b/.buildkite/scripts/steps/test/jest_parallel.sh index d3ee75b7add4a9a..2df2fe046bd2285 100755 --- a/.buildkite/scripts/steps/test/jest_parallel.sh +++ b/.buildkite/scripts/steps/test/jest_parallel.sh @@ -5,13 +5,12 @@ set -uo pipefail JOB=$BUILDKITE_PARALLEL_JOB JOB_COUNT=$BUILDKITE_PARALLEL_JOB_COUNT -# a jest failure will result in the script returning an exit -# code of 10 +# a jest failure will result in the script returning an exit code of 10 i=0 exitCode=0 -find src x-pack packages -name jest.config.js -not -path "*/__fixtures__/*" | sort | while read config; do +while read config; do if [ "$(($i % $JOB_COUNT))" -eq $JOB ]; then echo "--- $ node scripts/jest --config $config" node --max-old-space-size=5632 ./node_modules/.bin/jest --config=$config --runInBand --coverage=false @@ -23,6 +22,7 @@ find src x-pack packages -name jest.config.js -not -path "*/__fixtures__/*" | so fi ((i=i+1)) -done +# uses heredoc to avoid the while loop being in a sub-shell thus unable to overwrite exitCode +done <<< "$(find src x-pack packages -name jest.config.js -not -path "*/__fixtures__/*" | sort)" exit $exitCode \ No newline at end of file