-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-coverage.sh
More file actions
executable file
·47 lines (39 loc) · 1.83 KB
/
run-coverage.sh
File metadata and controls
executable file
·47 lines (39 loc) · 1.83 KB
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
44
45
46
47
#!/usr/bin/env bash
# Run the system extension RSpec suite with SimpleCov coverage tracking.
#
# Requires:
# 1. parent platform's server/Gemfile includes:
# gem 'simplecov', require: false, group: :test
# 2. parent platform's server/spec/spec_helper.rb (or rails_helper.rb)
# requires this extension's simplecov config at the top, e.g.:
# require_relative '../../extensions/system/server/spec/support/simplecov'
#
# Output: HTML report at extensions/system/coverage/index.html
#
# Usage:
# bash extensions/system/scripts/run-coverage.sh # full suite
# bash extensions/system/scripts/run-coverage.sh spec/controllers/... # subset
#
# Audit plan item: P3.7d (~/.claude/plans/forform-a-deep-examination-fizzy-lobster.md).
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
EXT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
PLATFORM_SERVER="$(cd "${EXT_ROOT}/../../server" 2>/dev/null && pwd || true)"
if [[ -z "${PLATFORM_SERVER}" || ! -f "${PLATFORM_SERVER}/Gemfile" ]]; then
echo "FATAL: cannot locate parent platform server/ (expected at \$EXT_ROOT/../../server)"
echo " This script assumes extensions/system/ is mounted inside powernode-platform/."
exit 1
fi
if ! grep -q "^[[:space:]]*gem ['\"]simplecov['\"]" "${PLATFORM_SERVER}/Gemfile"; then
echo "WARN: simplecov gem not in parent Gemfile. Coverage tracking will be skipped."
echo " Add to ${PLATFORM_SERVER}/Gemfile:"
echo " gem 'simplecov', require: false, group: :test"
echo " Then 'bundle install' and re-run."
echo ""
fi
cd "${PLATFORM_SERVER}"
# Default args: run the entire extension spec tree. Caller can override.
SPEC_ARGS="${*:-../extensions/system/server/spec}"
COVERAGE=1 bundle exec rspec --format progress ${SPEC_ARGS}
echo ""
echo "Coverage report: ${EXT_ROOT}/coverage/index.html"