aboutsummaryrefslogtreecommitdiff
path: root/test/bundler/report-bundler-test-progress.sh
blob: 1ee0fec66f40b5ad623a86fe4f26a84d456a6702 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash

tests="$(echo esbuild/* bundler*.test.ts)"

printf "%40s %7s %7s | %5s %5s %5s | %5s\n" "TEST" "defined" "refined" "pass" "fail" "skip" "%pass"

total_defined=0
total_total=0
total_pass=0
total_fail=0
total_skip=0

for test in $tests; do
  defined=$(grep "^import" $test -v | grep -v expectBundled.md | grep -Ec "expectBundled|itBundled")
  output=$(bun test $test 2>&1 | tail -n 5)
  pass=$(echo "$output" | grep "pass" | cut -d " " -f 2)
  fail=$(echo "$output" | grep "fail" | cut -d " " -f 2)
  skip=$(echo "$output" | grep "skip" | cut -d " " -f 2)
  if [ -z "$skip" ]; then skip=0; fi
  if [ -z "$fail" ]; then fail=0; fi
  if [ -z "$pass" ]; then pass=0; fi
  total=$((pass + fail + skip))
  percent_pass=$(echo "scale=1; ($pass * 100) / ($pass + $fail) " | bc 2>/dev/null || echo "-")
  printf "%40s %7s %7s | %5s %5s %5s | %5s%%\n" "$test" "$defined" "$total" "$pass" "$fail" "$skip" "$percent_pass"

  total_defined=$((total_defined + defined))
  total_total=$((total_total + total))
  total_pass=$((total_pass + pass))
  total_fail=$((total_fail + fail))
  total_skip=$((total_skip + skip))
done

total_pass_percent=$(echo "scale=1; ($total_pass * 100) / ($total_pass + $total_fail)")

printf -- "\n"
printf "%40s %7s %7s | %5s %5s %5s | %5s\n" "TOTAL" "$total_defined" "$total_total" "$total_pass" "$total_fail" "$total_skip" "$total_pass_percent"
printf "\n"
printf "\n"
printf "  %s%% Refined\n" $(echo "scale=1; $total_total / $total_defined * 100" | bc)
printf "  %s%% Passing\n" $(echo "scale=1; $total_pass / $total_total * 100" | bc)
printf "  %s%% Passing including what we skip\n" $(echo "scale=1; $total_pass / $total_total * 100" | bc)
printf "\n"
printf "dave's status: %s/%s tests\n" $total_total $total_defined