GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Implement `AsyncDisposable` to support TS 5.2's `using` by cristianrgreco · Pull Request #1080 · testcontainers/testcontainers-node

Conversation

@cristianrgreco

@cristianrgreco cristianrgreco commented Jul 17, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Feature info here: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management

Before:

const container = await new GenericContainer(/* ... */).start();
/* ... */
await container.stop();

After:

await using container = await new GenericContainer(/* ... */).start();
/* ... */

Same for Network and DockerComposeEnvironment.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

inf1nite-lo0p reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@cristianrgreco
Add support for TS 5.2 using
312361f
@netlify

netlify Bot commented Jul 17, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

✅ Deploy Preview for testcontainers-node ready!

Name Link
🔨 Latest commit 93f8550
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-node/deploys/687a3fef1b84850008773df1
😎 Deploy Preview https://deploy-preview-1080--testcontainers-node.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cristianrgreco added 3 commits July 17, 2025 16:08
@cristianrgreco
Fix abstract started container
a398291
@cristianrgreco
Update ALL the tests
71714ba
@cristianrgreco
Fix compilation issues
f7c0ccc
@cristianrgreco
cristianrgreco requested a review from Copilot July 17, 2025 21:07
Copilot AI reviewed Jul 17, 2025
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for TypeScript 5.2's using keyword, implementing automatic resource disposal for test containers. The changes modernize resource management by replacing manual await container.stop() calls with automatic disposal when containers go out of scope.

  • Updates container and network classes to implement AsyncDisposable interface
  • Modifies test files to use await using for automatic resource cleanup
  • Enhances helper functions to return disposable objects

Reviewed Changes

Copilot reviewed 73 out of 73 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/testcontainers/src/test-container.ts Extends StartedTestContainer interface with AsyncDisposable
packages/testcontainers/src/generic-container/started-generic-container.ts Implements Symbol.asyncDispose for containers
packages/testcontainers/src/network/network.ts Implements AsyncDisposable for networks
packages/testcontainers/src/utils/test-helper.ts Updates helper to return disposable event stream
Test files across all modules Replace manual cleanup with await using declarations

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/modules/weaviate/src/weaviate-container.test.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/modules/valkey/src/valkey-container.test.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread packages/modules/redpanda/src/redpanda-container.test.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

cristianrgreco added 8 commits July 18, 2025 08:47
@cristianrgreco
Fix compilation issues
cfe4a1b
@cristianrgreco
Fix compilation issues
f1f8526
@cristianrgreco
Fix compilation issues
7a1a78a
@cristianrgreco
Fix compilation issues
8508457
@cristianrgreco
Fix HiveMQ test
fbe3ccf
@cristianrgreco
Fix lifecycle test
1fbfd35
@cristianrgreco
Merge branch 'main' into add-support-for-ts-using
4836bda
@cristianrgreco
Updates for new module tests
93f8550
@cristianrgreco cristianrgreco changed the title Add support for TS 5.2 using Implement AsyncDisposable to support TS 5.2's using Jul 18, 2025
@cristianrgreco
cristianrgreco marked this pull request as ready for review July 18, 2025 12:40
@cristianrgreco cristianrgreco added enhancement New feature or request minor Backward compatible functionality labels Jul 18, 2025
@cristianrgreco
cristianrgreco merged commit a8cec38 into main Jul 18, 2025
@cristianrgreco
cristianrgreco deleted the add-support-for-ts-using branch July 18, 2025 16:09
joebowbeer
joebowbeer reviewed Dec 18, 2025
View reviewed changes
Comment thread packages/testcontainers/src/generic-container/abstract-started-container.ts
Comment on lines +102 to +104
async [Symbol.asyncDispose]() {
await this.startedTestContainer[Symbol.asyncDispose]();
}

@joebowbeer joebowbeer Dec 18, 2025

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cristianrgreco Shouldn't this call this.stop?

Suggested change
async [Symbol.asyncDispose]() {
await this.startedTestContainer[Symbol.asyncDispose]();
}
async [Symbol.asyncDispose]() {
await this.stop();
}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@joebowbeer joebowbeer mentioned this pull request Dec 18, 2025
AbstractStartedContainer asyncDispose should call this.stop #1202
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
+1 more reviewer
@joebowbeer joebowbeer joebowbeer left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement New feature or request minor Backward compatible functionality

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@cristianrgreco @joebowbeer
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.