UNPKG

476 Bapplication/x-shView Raw
1#!/usr/bin/env bash
2
3OUTPUT="./run-all-tests-output.log"
4
5exit_code=0
6
7node ./test-package.js > ${OUTPUT}
8
9_term() {
10 echo "Caught SIGTERM signal!"
11 kill -TERM "$child" 2>/dev/null
12}
13
14trap _term SIGTERM
15
16for filename in ./test/*.js; do
17 timeout 5s node "${filename}" >> ${OUTPUT} &
18
19 child=$!
20 wait "${child}"
21
22 if [ $? = 0 ]; then
23 echo ${filename} "passed!"
24 else
25 echo ${filename} "failed!"
26 exit_code=1
27 fi
28done
29
30exit ${exit_code}