Skip to content

SCUBA-338: Fix the client spec and run the test suite in CI - #83

Open
dvasilas wants to merge 4 commits into
development/1.1from
bugfix/SCUBA-338-fix-test-suite
Open

SCUBA-338: Fix the client spec and run the test suite in CI#83
dvasilas wants to merge 4 commits into
development/1.1from
bugfix/SCUBA-338-fix-test-suite

Conversation

@dvasilas

Copy link
Copy Markdown
Contributor

yarn test has been failing on development/1.1 since the jest 29 to 30 bump (4357689): tests/client.spec.ts did not compile, so no test executed.
CI was green because test.yaml only ran yarn lint and yarn build, and tsconfig.json excludes tests from the build.

Changes

  • Replace toThrowError with toThrow. jest 30 dropped the toThrowError alias from the typings and from the expect runtime, so these assertions failed to compile.
  • Match the connection error by code instead of message. The ECONNREFUSED test asserted on a message substring. Where localhost resolves to both ::1 and 127.0.0.1 — as it does on the GitHub runners — node tries both and reports the failure as an AggregateError with an empty message, so the substring never matched. code is ECONNREFUSED in both cases.
  • Await mockServer.close().
  • Add a Run tests step to .github/workflows/test.yaml.

jest 30 dropped the toThrowError alias from both the typings and the
expect runtime, so the spec failed to compile and no test ran.
On hosts where localhost resolves to both ::1 and 127.0.0.1, node tries
both and reports the failure as an AggregateError with an empty message,
so the substring match on ECONNREFUSED failed on the CI runners. The code
property carries ECONNREFUSED in both cases.

Also await the server close so the request cannot race the shutdown.
close() returns a promise. Leaving it unawaited let the hook finish while
the shutdown was still in flight.
test.yaml ran lint and build only. tsconfig excludes tests, so the build
never type-checked the spec and the breakage went unnoticed.
@dvasilas
dvasilas requested a review from tmacro as a code owner August 25, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant