Skip to content

Commit 6252348

Browse files
committed
Fix CI test-cli exit code 123 by replacing xargs with direct bun test
The xargs command was returning exit code 123 despite all tests passing due to orphaned child processes from e2e tests that spawn CLI instances. The 11-second delay after tests completed indicated hanging processes. Fix: Replace `find | xargs -I {} bun test {}` with `bun test $TEST_FILES` which runs all tests in a single invocation with proper process cleanup. Applied to: - Regular test jobs (test-cli and other packages) - Integration test jobs (test-integration-*) - Billing integration tests - Internal integration tests
1 parent a6547a1 commit 6252348

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,23 @@ jobs:
143143
command: |
144144
cd ${{ matrix.package }}
145145
if [ "${{ matrix.package }}" = ".agents" ]; then
146-
TEST_FILES=$(find __tests__ -name '*.test.ts' ! -name '*.integration.test.ts' 2>/dev/null | sort)
146+
TEST_FILES=$(find __tests__ -name '*.test.ts' ! -name '*.integration.test.ts' 2>/dev/null | sort | tr '\n' ' ')
147147
if [ -n "$TEST_FILES" ]; then
148-
echo "$TEST_FILES" | xargs -I {} bun test {}
148+
bun test $TEST_FILES
149149
else
150150
echo "No regular tests found in .agents"
151151
fi
152152
elif [ "${{ matrix.package }}" = "web" ]; then
153153
bun run test --runInBand
154154
else
155-
find src -name '*.test.ts' ! -name '*.integration.test.ts' | sort | xargs -I {} bun test {}
155+
# Run all non-integration tests in a single bun test invocation
156+
# This avoids xargs exit code issues with orphaned child processes
157+
TEST_FILES=$(find src -name '*.test.ts' ! -name '*.integration.test.ts' 2>/dev/null | sort | tr '\n' ' ')
158+
if [ -n "$TEST_FILES" ]; then
159+
bun test $TEST_FILES
160+
else
161+
echo "No tests found in ${{ matrix.package }}"
162+
fi
156163
fi
157164
158165
# - name: Open interactive debug shell
@@ -222,9 +229,9 @@ jobs:
222229
max_attempts: 3
223230
command: |
224231
cd ${{ matrix.package }}
225-
TEST_FILES=$(find src -name '*.integration.test.ts' 2>/dev/null | sort)
232+
TEST_FILES=$(find src -name '*.integration.test.ts' 2>/dev/null | sort | tr '\n' ' ')
226233
if [ -n "$TEST_FILES" ]; then
227-
echo "$TEST_FILES" | xargs -I {} bun test --timeout=60000 {}
234+
bun test --timeout=60000 $TEST_FILES
228235
else
229236
echo "No integration tests found in ${{ matrix.package }}"
230237
fi
@@ -310,9 +317,9 @@ jobs:
310317
max_attempts: 3
311318
command: |
312319
cd packages/billing
313-
TEST_FILES=$(find src -name '*.integration.test.ts' 2>/dev/null | sort)
320+
TEST_FILES=$(find src -name '*.integration.test.ts' 2>/dev/null | sort | tr '\n' ' ')
314321
if [ -n "$TEST_FILES" ]; then
315-
echo "$TEST_FILES" | xargs -I {} bun test --timeout=60000 {}
322+
bun test --timeout=60000 $TEST_FILES
316323
else
317324
echo "No integration tests found in packages/billing"
318325
fi
@@ -398,9 +405,9 @@ jobs:
398405
max_attempts: 3
399406
command: |
400407
cd packages/internal
401-
TEST_FILES=$(find src -name '*.integration.test.ts' 2>/dev/null | sort)
408+
TEST_FILES=$(find src -name '*.integration.test.ts' 2>/dev/null | sort | tr '\n' ' ')
402409
if [ -n "$TEST_FILES" ]; then
403-
echo "$TEST_FILES" | xargs -I {} bun test --timeout=60000 {}
410+
bun test --timeout=60000 $TEST_FILES
404411
else
405412
echo "No integration tests found in packages/internal"
406413
fi

0 commit comments

Comments
 (0)