Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
ci(e2e): fail the vitest gate on zero executed tests
Alfredo Lopezaa1343ef686e
diff --git a/scripts/e2e/run-vitest-e2e.sh b/scripts/e2e/run-vitest-e2e.shindex 114776c01..2d4adfb71 100755--- a/scripts/e2e/run-vitest-e2e.sh+++ b/scripts/e2e/run-vitest-e2e.sh@@ -227,11 +227,52 @@ fiwait_http mcp-host "${MCP_HOST_RUNTIME_HEALTH_BASE}/v1/runtime/health" 90 \|| die "mcp-host runtime health never became ready. Check ${PF_LOG}"+# ── Gate integrity: make a false green impossible ────────────────────────────+# The cluster-unreachable bypass (E2E_SKIP_IF_CLUSTER_UNREACHABLE) is for LOCAL+# exploration only: with it set, every `it()` returns early and the suite+# reports "passed" with zero assertions. An official gate that skips silently+# proves nothing. Refuse the bypass here so it can never turn a down cluster+# into a false green.+if [[ -n "${E2E_SKIP_IF_CLUSTER_UNREACHABLE:-}" ]]; then+ die "E2E_SKIP_IF_CLUSTER_UNREACHABLE is set — the gate refuses the skip bypass (a down cluster would report a false green). Unset it; the flag is for local exploration only."+fi++# Run Vitest and FAIL if zero tests actually executed, even on a green exit:+# "nothing failed" is not "everything passed". A renamed/deleted suite or an+# empty glob must not pass silently.+run_vitest_gate() {+ local log+ log="$(mktemp)"+ local status=0+ # Capture Vitest's real exit code across the tee (a pipe otherwise reports+ # tee's status). Guards below run regardless, to catch a green-but-empty run.+ set +e+ npx vitest run "$@" 2>&1 | tee "${log}"+ status="${PIPESTATUS[0]}"+ set -e+ if grep -qE "No test files found" "${log}"; then+ rm -f "${log}"+ die "Vitest reported 'No test files found' — zero tests executed. A gate that ran nothing is not green."+ fi+ if ! grep -qE "Tests +[1-9][0-9]* (passed|failed)" "${log}"; then+ rm -f "${log}"+ die "Vitest reported no executed tests (no 'Tests N' with N>0). Refusing to treat an empty run as success."+ fi+ rm -f "${log}"+ return "${status}"+}+log "Running Vitest E2E"cd tests/e2eif [[ "$#" -gt 0 ]]; then- npx vitest run "$@"+ run_vitest_gate "$@"elselog "No explicit Vitest specs supplied; running deterministic default suites"- npx vitest run "${DEFAULT_VITEST_SUITES[@]}"+ # A suite renamed or deleted out of this explicit list would resolve to zero+ # files and pass silently while the other suites keep files.length > 0. Fail+ # loud, by name, before running a single test.+ for suite in "${DEFAULT_VITEST_SUITES[@]}"; do+ [[ -f "${suite}" ]] || die "Vitest suite not found: ${suite} (renamed or deleted?). A gate cannot pass over a suite that never ran."+ done+ run_vitest_gate "${DEFAULT_VITEST_SUITES[@]}"fidiff --git a/tests/e2e/package-lock.json b/tests/e2e/package-lock.jsonindex 325494e85..ff5c7a550 100644--- a/tests/e2e/package-lock.json+++ b/tests/e2e/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-e2e-tests",- "version": "0.1.53",+ "version": "0.1.54","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-e2e-tests",- "version": "0.1.53",+ "version": "0.1.54","devDependencies": {"@types/jsonwebtoken": "^9.0.10","@types/node": "^22.0.0",diff --git a/tests/e2e/package.json b/tests/e2e/package.jsonindex 20427b6cb..060f55f1e 100644--- a/tests/e2e/package.json+++ b/tests/e2e/package.json@@ -1,6 +1,6 @@{"name": "clerum-e2e-tests",- "version": "0.1.53",+ "version": "0.1.54","private": true,"type": "module","scripts": {diff --git a/tests/e2e/vitest.config.ts b/tests/e2e/vitest.config.tsindex 0170033c8..ad92f444f 100644--- a/tests/e2e/vitest.config.ts+++ b/tests/e2e/vitest.config.ts@@ -1,19 +1,18 @@-import { defineConfig } from "vitest/config";+import { defineConfig } from 'vitest/config'export default defineConfig({test: {- include: [- "**/*.test.ts",- "integration/**/*.test.ts",- ],- exclude: [- "**/node_modules/**",- "**/fixtures/**/node_modules/**",- ],- testTimeout: 360_000, // 360s — workflow lifecycle tests wait up to 5 min for LLM execution+ include: ['**/*.test.ts', 'integration/**/*.test.ts'],+ exclude: ['**/node_modules/**', '**/fixtures/**/node_modules/**'],+ testTimeout: 360_000, // 360s — workflow lifecycle tests wait up to 5 min for LLM executionhookTimeout: 360_000,fileParallelism: false,sequence: { concurrent: false },- reporters: ["verbose"],+ reporters: ['verbose'],+ // A run that matched zero test files must FAIL, never exit 0. Vitest's+ // default is `true` (fail-open); an e2e gate that resolves an empty glob+ // proves nothing. The runner (scripts/e2e/run-vitest-e2e.sh) adds a+ // per-suite existence precheck and a "Tests N>0" floor guard on top.+ passWithNoTests: false,},-});+})