mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-05 00:45:29 +08:00
feat: introduce new quality gates, Node.js syntax checks, and manual smoke test status validation
This commit is contained in:
38
tests/scripts/check-node-split-syntax.sh
Executable file
38
tests/scripts/check-node-split-syntax.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
TARGETS_FILE="${1:-$ROOT_DIR/plans/node-syntax-gate-targets.txt}"
|
||||
|
||||
if [[ ! -f "$TARGETS_FILE" ]]; then
|
||||
echo "missing targets file: $TARGETS_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
checked=0
|
||||
missing=0
|
||||
invalid=0
|
||||
|
||||
while IFS= read -r file; do
|
||||
[[ -z "$file" ]] && continue
|
||||
[[ "${file:0:1}" == "#" ]] && continue
|
||||
|
||||
checked=$((checked + 1))
|
||||
abs="$ROOT_DIR/$file"
|
||||
if [[ ! -f "$abs" ]]; then
|
||||
echo "MISSING $file"
|
||||
missing=$((missing + 1))
|
||||
continue
|
||||
fi
|
||||
|
||||
if ! node --check "$abs"; then
|
||||
echo "INVALID $file"
|
||||
invalid=$((invalid + 1))
|
||||
fi
|
||||
done < "$TARGETS_FILE"
|
||||
|
||||
echo "checked=$checked missing=$missing invalid=$invalid"
|
||||
|
||||
if (( missing > 0 || invalid > 0 )); then
|
||||
exit 1
|
||||
fi
|
||||
52
tests/scripts/check-stage6-manual-smoke.sh
Executable file
52
tests/scripts/check-stage6-manual-smoke.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
SMOKE_FILE="${1:-$ROOT_DIR/plans/stage6-manual-smoke.md}"
|
||||
|
||||
if [[ ! -f "$SMOKE_FILE" ]]; then
|
||||
echo "missing smoke file: $SMOKE_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
extract_field() {
|
||||
local field="$1"
|
||||
local line
|
||||
line="$(grep -E "^[[:space:]]*-[[:space:]]*$field:" "$SMOKE_FILE" | head -n 1 || true)"
|
||||
if [[ -z "$line" ]]; then
|
||||
echo ""
|
||||
return
|
||||
fi
|
||||
printf '%s' "$line" | sed -E "s/^[[:space:]]*-[[:space:]]*$field:[[:space:]]*//" | sed -E 's/`//g;s/^[[:space:]]+//;s/[[:space:]]+$//'
|
||||
}
|
||||
|
||||
date_value="$(extract_field "Date")"
|
||||
tester_value="$(extract_field "Tester")"
|
||||
env_value="$(extract_field "Environment")"
|
||||
status_value="$(extract_field "Status")"
|
||||
status_upper="$(printf '%s' "$status_value" | tr '[:lower:]' '[:upper:]')"
|
||||
|
||||
failed=0
|
||||
|
||||
if [[ -z "$date_value" ]]; then
|
||||
echo "invalid smoke file: Date is empty"
|
||||
failed=1
|
||||
fi
|
||||
if [[ -z "$tester_value" ]]; then
|
||||
echo "invalid smoke file: Tester is empty"
|
||||
failed=1
|
||||
fi
|
||||
if [[ -z "$env_value" ]]; then
|
||||
echo "invalid smoke file: Environment is empty"
|
||||
failed=1
|
||||
fi
|
||||
if [[ "$status_upper" != "PASS" ]]; then
|
||||
echo "invalid smoke file: Status must be PASS (got: ${status_value:-<empty>})"
|
||||
failed=1
|
||||
fi
|
||||
|
||||
if (( failed != 0 )); then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "stage6_manual_smoke=PASS file=$SMOKE_FILE"
|
||||
@@ -4,4 +4,5 @@ set -euo pipefail
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
./tests/scripts/check-node-split-syntax.sh
|
||||
node --test api/helpers/stream-tool-sieve.test.js api/chat-stream.test.js api/compat/js_compat_test.js "$@"
|
||||
|
||||
Reference in New Issue
Block a user