diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ca507bf9..e7cf9302 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,13 +10,12 @@ jobs: services: nexusd: image: ghcr.io/gammazero/nexusd:latest - ports: - - 8080:8080 + ports: [8080:8080] command: -realm test1 -ws 0.0.0.0:8080 strategy: matrix: - node-version: [22, 24, 26] + node-version: [24, 26] steps: - uses: actions/checkout@v7 diff --git a/package-lock.json b/package-lock.json index 1675ade4..86c1c6b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -617,22 +617,25 @@ } }, "node_modules/@napi-rs/wasm-runtime": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz", - "integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.3.tgz", + "integrity": "sha512-UMduMbqO5s5zF2NkNacMT/yK5Y5QiKvWr2+50bzIIxFDwVJ2h49b+oyjaCGPhJxd2/gC2x39EHv/gHVuu36x2Q==", "dev": true, "license": "MIT", "optional": true, "dependencies": { "@tybys/wasm-util": "^0.10.3" }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, "funding": { "type": "github", "url": "https://github.com/sponsors/Brooooooklyn" }, "peerDependencies": { - "@emnapi/core": "^1.7.1", - "@emnapi/runtime": "^1.7.1" + "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", + "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "node_modules/@octokit/auth-token": { diff --git a/src/program.ts b/src/program.ts index ba9118ec..b8b595c9 100644 --- a/src/program.ts +++ b/src/program.ts @@ -2,7 +2,7 @@ import { Connection } from 'autobahn' import { program } from 'commander' -import * as repl from './repl.js' +import * as repl from './repl.ts' import 'colors' import { createRequire } from 'node:module' diff --git a/test/repl.test.ts b/test/repl.test.ts index b6d353ce..25abf17a 100644 --- a/test/repl.test.ts +++ b/test/repl.test.ts @@ -1,4 +1,5 @@ import { test } from 'node:test' +import { setTimeout } from 'node:timers/promises' import assert from 'node:assert/strict' import { spawn } from 'node:child_process' import { once } from 'node:events' @@ -91,13 +92,13 @@ test( replSession.send('{ok: true, from: e2e}') await waitForOutput( replSession.readOutput, - new RegExp(`PUB>\\s+${escapeRegExp(topic)}>`), + new RegExp(`Published to\\s+${escapeRegExp(topic)}`), 10_000, ) assert.match( replSession.readOutput(), - new RegExp(`PUB>\\s+${escapeRegExp(topic)}>`), + new RegExp(`Published to\\s+${escapeRegExp(topic)}`), ) }, ) @@ -141,18 +142,10 @@ async function startReplSession() { child.stdin.write('.exit\n') - const closed = Promise.race([ - once(child, 'exit'), - new Promise((_, reject) => { - setTimeout( - () => reject(new Error('child did not exit in time')), - 2_000, - ) - }), - ]) - try { - await closed + await once(child, 'exit', { + signal: AbortSignal.timeout(2_000), + }) } catch { child.kill('SIGKILL') await once(child, 'exit') @@ -178,7 +171,7 @@ async function waitForOutput( return } - await new Promise((resolve) => setTimeout(resolve, 25)) + await setTimeout(25) } throw new Error( diff --git a/tsconfig.json b/tsconfig.json index 1f539638..d6d6d460 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,6 +13,8 @@ "verbatimModuleSyntax": true, "importHelpers": true, "declaration": true, + "allowImportingTsExtensions": true, + "rewriteRelativeImportExtensions": true, // Best practices "strict": true,