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
This commit is contained in:
@@ -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
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user