kunibert
All repositories: gitoria
1.3 KB
// refused-catch.mjs — mission 517 (hybriel#240). A fetch to a closed port, an unknown host// and a closed https port must each give an error `on Error` can catch, with the host:port and// the reason in the message, and the program must run on to its end.import { spawnSync } from 'node:child_process';import net from 'node:net';import path from 'node:path';import { fileURLToPath } from 'node:url';const HERE = path.dirname(fileURLToPath(import.meta.url));const ROOT = path.resolve(HERE, '../../..');const BIN = process.env.HL_BIN || path.resolve(ROOT, 'native/zig-out/bin/hybriel');// Find a port nothing listens on: bind one, note it, close it.const probe = net.createServer();await new Promise((r) => probe.listen(0, '127.0.0.1', r));const port = probe.address().port;await new Promise((r) => probe.close(r));const r = spawnSync(BIN, [path.join(HERE, 'refused_catch.hl')], {env: { ...process.env, HL_TEST_PORT: String(port) }, encoding: 'utf8', timeout: 60000,});const log = (r.stdout || '') + (r.stderr || '');const ok = r.status === 0&& log.includes(`127.0.0.1:${port}/x: connection refused`)&& log.includes('could not resolve host')&& log.includes('done 3 true true true');if (ok) { console.log('PASS refused, https refused and unknown host are caught'); process.exit(0); }console.log(`FAIL exit ${r.status}\n` + log.slice(-1500));process.exit(1);
Branches
Latest commits
- 4a68016bMerge branch 'hl-standard-l10b' into mainKunibert
- 246d0f30|||PR HL-STANDARD L10 update (hybriel ab293e5a), rules version 4mre
- 1aa4d64crecords: HL-STANDARD L10 update livemre
- 2b04c240Merge branch 'hl-standard-l10' into mainKunibert
- 88c7b09d|||PR HL-STANDARD L10 update (hybriel 5885d688), rules version 3mre
- 00869ecbrecords: gitoria#50 step 3 livemre
- f97a0e5fMerge branch 'hl-standard' into mainKunibert
- 9710e39fType STANDARD as String (L10, Kunibert review)mre
- 4140b664|||PR Review against HL-STANDARD and cite rule ids (gitoria#50 step 3)mre
- 75c6888drecords: gitoria#50 step 1 connected and provenmre
- aa6d997frecords: gitoria#50 connect plan, Anton reportmre
- 8a190ba7Records: kunibert#18 and #15 donemre
- 2eee9dbbMerge branch 'revendor-day44' into mainKunibert
- e96721cb|||PR Re-vendor plugins from Hybriel day44 (hl:fetch redirect fix)mre
- 0c67ab8cLog: kunibert repo ping provenmre
- b6f3039cLog: kunibert repo connectedmre
- b143c3c7CONDUCTOR: push recipemre
- 7a1279eeRule: conductor merges own utility PRs after green reviewmre
- 4038b3e0Log: kunibert#18 openedmre
- 18543db1Log: day42 fetch fix, re-vendor pendingmre