gitoria

jukebox

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit2e7f6a432e7f6a43Vendor virtual-list 489afcf from components.hybrielmre2e7f6a43/plugins/fetch/tests/refused-catch.mjs

1.3 KB

  1. // refused-catch.mjs — mission 517 (hybriel#240). A fetch to a closed port, an unknown host
  2. // and a closed https port must each give an error `on Error` can catch, with the host:port and
  3. // the reason in the message, and the program must run on to its end.
  4. import { spawnSync } from 'node:child_process';
  5. import net from 'node:net';
  6. import path from 'node:path';
  7. import { fileURLToPath } from 'node:url';
  8. const HERE = path.dirname(fileURLToPath(import.meta.url));
  9. const ROOT = path.resolve(HERE, '../../..');
  10. const BIN = process.env.HL_BIN || path.resolve(ROOT, 'native/zig-out/bin/hybriel');
  11. // Find a port nothing listens on: bind one, note it, close it.
  12. const probe = net.createServer();
  13. await new Promise((r) => probe.listen(0, '127.0.0.1', r));
  14. const port = probe.address().port;
  15. await new Promise((r) => probe.close(r));
  16. const r = spawnSync(BIN, [path.join(HERE, 'refused_catch.hl')], {
  17. env: { ...process.env, HL_TEST_PORT: String(port) }, encoding: 'utf8', timeout: 60000,
  18. });
  19. const log = (r.stdout || '') + (r.stderr || '');
  20. const ok = r.status === 0
  21. && log.includes(`127.0.0.1:${port}/x: connection refused`)
  22. && log.includes('could not resolve host')
  23. && log.includes('done 3 true true true');
  24. if (ok) { console.log('PASS refused, https refused and unknown host are caught'); process.exit(0); }
  25. console.log(`FAIL exit ${r.status}\n` + log.slice(-1500));
  26. process.exit(1);

Branches

Latest commits

  • 2e7f6a43Vendor virtual-list 489afcf from components.hybrielmre
  • 0ba85799Merge branch 'reset-classes' into mainJukebox
  • 502eeed5jukebox#20: vendor virtual-list initial resetKey baseline fixmre
  • 3b76651cjukebox#20: update virtual-list README pin and resetKey optionsmre
  • bc09e1e8|||PR jukebox#20: reset virtual lists through resetKey (partial validation)mre
  • 10f8a8c8Merge branch 'code-order' into mainJukebox
  • 204fc828Merge branch 'day72' into mainJukebox
  • 95f5faae|||PR jukebox#7 Drop needless let declarationsmre
  • 33072bb5|||PR Record day72 gates and Chrome proofmre
  • 95f2cd73|||PR Use typed parent methods for screen playback and local server facesmre
  • 6422a020Sync media-player at 51c3818mre
  • b582ba1cVendor complete Hybriel day72 plugin setmre
  • 02dccbc9Merge branch 'records-1119' into mainJukebox
  • a39e1c23|||PR Records: missions 013-015, reconnect fix livemre
  • fc7db075Merge branch 'reconnect-retry' into mainJukebox
  • ac6f4c6fL2: plain declaration for a in pickedNextmre
  • 2f335086Review round 2: only an explicit queue pick drops pend (not the automatic advance); jb23 records every source changemre
  • 3eb6695fReview fixes: action generation, queue pick clears pend, Previous/Next retry the decided request, typed handlersmre
  • 7a53c0c2|||PR A tap lost to a dead socket plays after reconnect (mission 015)mre
  • 1f0cd77bMerge branch 'records-day41' into mainJukebox