From 9573718da59c7ebe7ac95cbb628f3630ddd002af Mon Sep 17 00:00:00 2001 From: alexpaynex <55271826-alexpaynex@users.noreply.replit.com> Date: Thu, 19 Mar 2026 21:16:48 +0000 Subject: [PATCH] Update test summary and improve module import for better portability Modify the testkit route to prefer bare module imports for 'nostr-tools' and update the test summary output to include a total test count. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 418bf6f8-212b-4bb0-a7a5-8231a061da4e Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 669fca88-557b-488a-99e4-05ffaa036833 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/9f85e954-647c-46a5-90a7-396e495a805a/418bf6f8-212b-4bb0-a7a5-8231a061da4e/67YBlXt Replit-Helium-Checkpoint-Created: true --- artifacts/api-server/src/routes/testkit.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/artifacts/api-server/src/routes/testkit.ts b/artifacts/api-server/src/routes/testkit.ts index 029c27d..0ec19e6 100644 --- a/artifacts/api-server/src/routes/testkit.ts +++ b/artifacts/api-server/src/routes/testkit.ts @@ -975,10 +975,10 @@ const https = require('https'); const http = require('http'); const BASE = process.argv[2]; -// Try the absolute CJS bundle path first (dev/Replit), then bare module name. +// Prefer bare module name (portable), fall back to absolute CJS bundle for Replit. let nt; const NOSTR_CJS = '/home/runner/workspace/artifacts/api-server/node_modules/nostr-tools/lib/cjs/index.js'; -try { nt = require(NOSTR_CJS); } catch { try { nt = require('nostr-tools'); } catch { process.stderr.write('nostr-tools not importable\n'); process.exit(1); } } +try { nt = require('nostr-tools'); } catch { try { nt = require(NOSTR_CJS); } catch { process.stderr.write('nostr-tools not importable\n'); process.exit(1); } } const { generateSecretKey, getPublicKey, finalizeEvent } = nt; function request(url, opts, body) { @@ -1087,8 +1087,9 @@ fi # Summary # --------------------------------------------------------------------------- echo +TOTAL=\$((PASS+FAIL+SKIP)) echo "=======================================" -echo " RESULTS: PASS=\$PASS FAIL=\$FAIL SKIP=\$SKIP" +echo " RESULTS: PASS=\$PASS/\$TOTAL FAIL=\$FAIL SKIP=\$SKIP" echo "=======================================" if [[ "\$FAIL" -gt 0 ]]; then exit 1; fi `;