Skip to content

Commit

Permalink
No subshell
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
  • Loading branch information
Tyler Smalley committed Nov 2, 2021
1 parent 501de79 commit 73630b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .buildkite/scripts/steps/test/jest_parallel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 73630b6

Please sign in to comment.