@@ -214,6 +214,15 @@ echo "[*] Found $TOTAL tests, running with $MAX_JOBS parallel jobs"
214214[[ $SKIPPED -gt 0 ]] && echo " [*] Skipped $SKIPPED tests (require host features)"
215215echo " "
216216
217+ # Runtime commands (bunx mocha for Bun, mocha for Node)
218+ if [[ " $RUNTIME " == " bun" ]]; then
219+ MOCHA=" bunx mocha"
220+ JSRUN=" bun"
221+ else
222+ MOCHA=" mocha"
223+ JSRUN=" node"
224+ fi
225+
217226# Run a single test in a container (with isolated codebase copy)
218227run_test () {
219228 local test_spec=$1
@@ -235,28 +244,28 @@ run_test() {
235244 cat " $CODEBASE_TAR " | docker run --rm -i \
236245 --mount type=tmpfs,destination=/root/.pm2 \
237246 " $IMAGE_NAME " \
238- bash -c " tar -xf - && mocha --exit --timeout 10000 --bail $test_path " \
247+ bash -c " tar -xf - && $MOCHA --exit --timeout 10000 --bail $test_path " \
239248 > " $log_file " 2>&1
240249 elif [[ " $test_type " == " axon" ]]; then
241- # Axon: custom runner (runs test file with node directly)
250+ # Axon: custom runner (runs test file directly)
242251 cat " $CODEBASE_TAR " | docker run --rm -i \
243252 " $IMAGE_NAME " \
244- bash -c " tar -xf - && node $test_path " \
253+ bash -c " tar -xf - && $JSRUN $test_path " \
245254 > " $log_file " 2>&1
246255 elif [[ " $test_type " == " io-agent" ]] || [[ " $test_type " == " axon-rpc" ]]; then
247256 # IO Agent / Axon-RPC: mocha with spec reporter
248257 cat " $CODEBASE_TAR " | docker run --rm -i \
249258 --mount type=tmpfs,destination=/root/.pm2 \
250259 " $IMAGE_NAME " \
251- bash -c " tar -xf - && mocha --reporter spec --exit --bail $test_path " \
260+ bash -c " tar -xf - && $MOCHA --reporter spec --exit --bail $test_path " \
252261 > " $log_file " 2>&1
253262 else
254263 # Unit: extract codebase, run with mocha
255264 # Use tmpfs for ~/.pm2 to speed up PM2 file I/O
256265 cat " $CODEBASE_TAR " | docker run --rm -i \
257266 --mount type=tmpfs,destination=/root/.pm2 \
258267 " $IMAGE_NAME " \
259- bash -c " tar -xf - && mocha --exit --bail $test_path " \
268+ bash -c " tar -xf - && $MOCHA --exit --bail $test_path " \
260269 > " $log_file " 2>&1
261270 fi
262271}
0 commit comments