Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
21 changes: 7 additions & 14 deletions test/repl.test.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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)}`),
)
},
)
Expand Down Expand Up @@ -141,18 +142,10 @@ async function startReplSession() {

child.stdin.write('.exit\n')

const closed = Promise.race([
once(child, 'exit'),
new Promise<never>((_, 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')
Expand All @@ -178,7 +171,7 @@ async function waitForOutput(
return
}

await new Promise<void>((resolve) => setTimeout(resolve, 25))
await setTimeout(25)
}

throw new Error(
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"verbatimModuleSyntax": true,
"importHelpers": true,
"declaration": true,
"allowImportingTsExtensions": true,
"rewriteRelativeImportExtensions": true,

// Best practices
"strict": true,
Expand Down