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

@sls-testing/core

v1.0.1

Published

Typed, composable testing utilities for AWS Lambda — event builders, context mock, response asserters

Downloads

17

Readme

@sls-testing/core

Typed event builders, Lambda context mock, and response asserters for testing AWS Lambda functions.

Framework-agnostic. Works with Jest, Vitest, or any test runner.

Install

npm install @sls-testing/core --save-dev

Requires @types/aws-lambda as a peer dependency:

npm install @types/aws-lambda --save-dev

Event Builders

Every builder returns a fully-typed event with sensible defaults. Pass a partial override to customize any field.

API Gateway

import { buildApiGatewayEvent, buildApiGatewayV1Event } from '@sls-testing/core'

// HTTP API (v2) — default
const event = buildApiGatewayEvent({
  requestContext: { http: { method: 'POST' } },
  rawPath: '/users',
  body: JSON.stringify({ name: 'Lucas' }),
})

// REST API (v1)
const v1Event = buildApiGatewayV1Event({
  httpMethod: 'GET',
  path: '/users',
  pathParameters: { id: '42' },
})

SQS

import { buildSQSEvent } from '@sls-testing/core'

const event = buildSQSEvent({
  records: [
    { body: { orderId: 'abc-123', amount: 99.9 } },
    { body: { orderId: 'def-456', amount: 49.9 } },
  ],
})
// Bodies are auto-serialized to JSON strings
// Each record gets a unique messageId

S3

import { buildS3Event } from '@sls-testing/core'

const event = buildS3Event({
  bucket: 'my-bucket',
  key: 'uploads/image.png',
  eventName: 'ObjectCreated:Put', // default
})

EventBridge

import { buildEventBridgeEvent } from '@sls-testing/core'

const event = buildEventBridgeEvent({
  source: 'app.orders',
  'detail-type': 'OrderPlaced',
  detail: { orderId: 'abc-123' },
})

SNS

import { buildSNSEvent } from '@sls-testing/core'

const event = buildSNSEvent({
  records: [{ message: { action: 'notify' }, topicArn: 'arn:aws:sns:...' }],
})

DynamoDB Streams

import { buildDynamoDBStreamEvent } from '@sls-testing/core'

const event = buildDynamoDBStreamEvent({
  records: [{
    eventName: 'INSERT',
    keys: { id: 'abc' },
    newImage: { id: 'abc', name: 'Lucas', count: 42 },
  }],
})
// Values are auto-marshalled to DynamoDB AttributeValue format

Lambda Context Mock

import { buildLambdaContext } from '@sls-testing/core'

const context = buildLambdaContext({
  functionName: 'my-service-dev-processOrder',
  memoryLimitInMB: '512',
  remainingTimeOverride: 3000, // ms
})

context.getRemainingTimeInMillis() // 3000

Response Asserters

Framework-agnostic assertion functions that throw on mismatch.

import { assertApiResponse, assertSQSBatchResponse } from '@sls-testing/core'

assertApiResponse(response, {
  statusCode: 201,
  bodyContains: { userId: '123' },
  headers: { 'content-type': 'application/json' },
})

assertSQSBatchResponse(response, {
  failedMessageIds: ['msg-2'],
})

License

MIT