File tree Expand file tree Collapse file tree 1 file changed +27
-21
lines changed Expand file tree Collapse file tree 1 file changed +27
-21
lines changed Original file line number Diff line number Diff line change 2323
2424# Function to run unit tests for specific Node version
2525run_unit_tests () {
26- local node_version=$1
27- echo " Running unit tests for Node.js $node_version ..."
28- docker build -f test/unit/Dockerfile.nodejs${node_version} .x -t unit/nodejs.${node_version} x .
29- docker run --rm unit/nodejs.${node_version} x
26+ local node_version=$1
27+ echo " Running unit tests for Node.js $node_version ..."
28+ docker build -f test/unit/Dockerfile.nodejs${node_version} .x -t unit/nodejs.${node_version} x . || {
29+ echo " Build failed for Node.js $node_version "
30+ exit 1
31+ }
32+ docker run --rm unit/nodejs.${node_version} x || {
33+ echo " Tests failed for Node.js $node_version "
34+ exit 1
35+ }
3036}
3137
3238# Parse command line arguments
3339case " ${1:- all} " in
34- " unit" )
35- NODE_VERSION=${2:- " 20" }
36- run_unit_tests $NODE_VERSION
37- ;;
38- " all" )
39- echo " Running unit tests for all Node versions..."
40- for version in 18 20 22; do
41- run_unit_tests $version
42- done
43- ;;
44- * )
45- echo " Usage: $0 [unit|all] [node_version]"
46- echo " Examples:"
47- echo " $0 unit 20 # Run unit tests for Node 20"
48- echo " $0 all # Run unit tests for all Node versions"
49- exit 1
50- ;;
40+ " unit" )
41+ NODE_VERSION=${2:- " 20" }
42+ run_unit_tests $NODE_VERSION
43+ ;;
44+ " all" )
45+ echo " Running unit tests for all Node versions..."
46+ for version in 18 20 22; do
47+ run_unit_tests $version
48+ done
49+ ;;
50+ * )
51+ echo " Usage: $0 [unit|all] [node_version]"
52+ echo " Examples:"
53+ echo " $0 unit 20 # Run unit tests for Node 20"
54+ echo " $0 all # Run unit tests for all Node versions"
55+ exit 1
56+ ;;
5157esac
You can’t perform that action at this time.
0 commit comments