Skip to content

Commit 8e9a83c

Browse files
committed
fail faster
1 parent f19e83f commit 8e9a83c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

apps/remix-ide/ci/browser_test.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@ sleep 5
1717
node apps/remix-ide/ci/splice_tests.js $2 $3
1818
TESTFILES=$(node apps/remix-ide/ci/splice_tests.js $2 $3 | grep -v 'metamask' | circleci tests split --split-by=timings)
1919
for TESTFILE in $TESTFILES; do
20-
npx nightwatch --config dist/apps/remix-ide-e2e/nightwatch-${1}.js dist/apps/remix-ide-e2e/src/tests/${TESTFILE}.js --env=$1 || npx nightwatch --config dist/apps/remix-ide-e2e/nightwatch-${1}.js dist/apps/remix-ide-e2e/src/tests/${TESTFILE}.js --env=$1 || TEST_EXITCODE=1
20+
if ! npx nightwatch --config dist/apps/remix-ide-e2e/nightwatch-${1}.js dist/apps/remix-ide-e2e/src/tests/${TESTFILE}.js --env=$1; then
21+
TEST_EXITCODE=1
22+
break
23+
fi
2124
done
2225

2326
echo "$TEST_EXITCODE"
24-
if [ "$TEST_EXITCODE" -eq 1 ]
25-
then
27+
# Fail the test early and cancel the workflow
28+
if [ "$TEST_EXITCODE" -eq 1 ]; then
29+
echo "❌ Test failed. Attempting to cancel the workflow..."
30+
curl -s -X POST "https://circleci.com/api/v2/workflow/${CIRCLE_WORKFLOW_ID}/cancel" \
31+
-H "Circle-Token: $FAIL_FAST_TOKEN" \
32+
-H "Content-Type: application/json"
2633
exit 1
2734
fi

0 commit comments

Comments
 (0)