Skip to content

test(client-typescript): disconnect timeout guard should reject instead of resolve #968

@coderabbitai

Description

@coderabbitai

Problem

In packages/client-typescript/tests/RocketRideClient.test.ts and packages/client-typescript/tests/deploy.test.ts, the afterEach teardown uses a timeout promise that resolves after 10 s:

await Promise.race([
  client.disconnect(),
  new Promise<void>((resolve) => setTimeout(resolve, 10000)),
]);

Because the timeout branch resolves (rather than rejects), afterEach returns successfully even when client.disconnect() never settles. This masks teardown hangs and can leave pending work that leaks into subsequent tests.

Suggested fix

Change the timeout promise to reject so that the test fails fast when a hang occurs:

await Promise.race([
  client.disconnect(),
  new Promise<never>((_, reject) =>
    setTimeout(() => reject(new Error('client.disconnect() timed out after 10s')), 10000),
  ),
]);

Apply the fix to both affected files:

  • packages/client-typescript/tests/RocketRideClient.test.ts
  • packages/client-typescript/tests/deploy.test.ts

Context

Identified during review of PR #805 (comment: #805 (comment)).

Requested by @stepmikhaylov.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions