fix(ci): security-gate skips frontend tests when vitest not installed

security-gate.sh checked only `command -v node` before running
`npm test -w frontend`. In the CI security-gate job, node is in PATH
(from actions/setup-node) but root node_modules are NOT installed
(npm ci was removed to prevent OOM). This caused the frontend test to
fail with "Cannot find module vitest".

Fix: also require node_modules/.bin/vitest to exist. Without it the
step SKIPs gracefully — frontend tests are already covered by the
dedicated frontend-tests CI job which runs first.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
thanhnv
2026-07-01 17:24:57 +09:00
co-authored by Claude Sonnet 4.6
parent 9229fee656
commit b0864a59d7
@@ -41,10 +41,10 @@ if [[ -d "$FNM_NODE_DIR" ]]; then
NODE_BIN=$(find "$FNM_NODE_DIR" -name "node.exe" -maxdepth 4 2>/dev/null | sort -V | tail -1) NODE_BIN=$(find "$FNM_NODE_DIR" -name "node.exe" -maxdepth 4 2>/dev/null | sort -V | tail -1)
[[ -n "$NODE_BIN" ]] && export PATH="$(dirname "$NODE_BIN"):$PATH" [[ -n "$NODE_BIN" ]] && export PATH="$(dirname "$NODE_BIN"):$PATH"
fi fi
if command -v node >/dev/null 2>&1; then if command -v node >/dev/null 2>&1 && [[ -f "$ROOT/node_modules/.bin/vitest" ]]; then
run "frontend runtime tests (WV4-A)" bash -c "cd '$ROOT' && npm test -w frontend" run "frontend runtime tests (WV4-A)" bash -c "cd '$ROOT' && npm test -w frontend"
else else
echo " GATE SKIP frontend runtime tests (node not in PATH)"; SKIP=$((SKIP+1)) echo " GATE SKIP frontend runtime tests (vitest not installed — covered by frontend-tests CI job)"; SKIP=$((SKIP+1))
fi fi
echo "== verdict: PASS=$PASS FAIL=$FAIL SKIP=$SKIP ==" echo "== verdict: PASS=$PASS FAIL=$FAIL SKIP=$SKIP =="