npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tsed/testcontainers-localstack

v8.38.7

Published

A module to test Ts.ED code that use AWS services using LocalStack and Test Containers

Downloads

916

Readme

semantic-release code style: prettier github opencollective

A package for the Ts.ED framework to help you test your code using the TestContainers library with LocalStack.

Note: This package does not depend on @tsed/platform-http. You can use it with any test framework.


✨ Features

  • 🚀 Spin up a LocalStack server using TestContainers for your tests
  • 🛑 Automatically stop the LocalStack server after your tests
  • 🔧 Configure AWS services to use in your tests
  • 🌐 Set environment variables for AWS SDK to use LocalStack

📦 Installation

Install with your favorite package manager:

npm install --save-dev @tsed/testcontainers-localstack @testcontainers/localstack
yarn add --dev @tsed/testcontainers-localstack @testcontainers/localstack
pnpm add --dev @tsed/testcontainers-localstack @testcontainers/localstack
bun add --dev @tsed/testcontainers-localstack @testcontainers/localstack

This package uses @testcontainers/localstack which provides a specialized container for LocalStack.


⚙️ Configuration

Set up a global test lifecycle to manage the LocalStack container.

🧪 Vitest

Add a global setup file in your vitest.config.ts:

import {defineConfig} from "vitest/config";
import {localstackPlugin} from "@tsed/testcontainers-localstack/vitest/plugin";

export default defineConfig({
  plugins: [
    localstackPlugin({
      // Optional: image name (defaults to "localstack/localstack:latest")
      image: "localstack/localstack:latest",
      // Optional: specify services to start
      services: ["s3", "dynamodb", "lambda"],
      // Optional: specify default region
      defaultRegion: "us-east-1",
      // Optional: specify edge port
      edgePort: 4566
    })
  ],
  test: {}
});

🚀 Usage

Basic Usage

import {TestContainersLocalstack} from "@tsed/testcontainers-localstack";
import {ListBucketsCommand, S3Client} from "@aws-sdk/client-s3";

describe("S3 Tests", () => {
  let s3Client: S3Client;

  beforeEach(async () => {
    // Create an S3 client that points to LocalStack
    s3Client = new S3Client({
      endpoint: TestContainersLocalstack.getUrl(),
      region: "us-east-1",
      credentials: {
        accessKeyId: "test",
        secretAccessKey: "test"
      },
      forcePathStyle: true
    });
  });
  afterEach(async () => {
    // Clean up any resources
    try {
      await s3Client.send(new DeleteBucketCommand({Bucket: bucketName}));
    } catch (error) {
      // Ignore errors if bucket doesn't exist
    }
  });

  it("should list buckets", async () => {
    const response = await s3Client.send(new ListBucketsCommand({}));
    expect(response.Buckets).toBeDefined();
  });
});

Environment Variables

The following environment variables are automatically set when the container starts:

  • LOCALSTACK_URL: The URL of the LocalStack container
  • AWS_ENDPOINT: The URL of the LocalStack container (for AWS SDK)
  • AWS_ACCESS_KEY_ID: Set to "test"
  • AWS_SECRET_ACCESS_KEY: Set to "test"
  • AWS_REGION: The default region (defaults to "us-east-1")

Contributors

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

License

The MIT License (MIT)

Copyright (c) 2016 - 2022 Romain Lenzotti

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.