New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aws-lambda-test-helper

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-lambda-test-helper

Simple, lightweight tool to help with testing AWS Lambda functions

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Build Status

NPM

A promise based test helper for running node aws lambda functions

Simple, lightweight tool to help with testing AWS Lambda functions. No dependencies to run.

Example

const expect = require('chai').expect; // chai used for example purposes
const runLambda = require('aws-lambda-test-helper');

const config = {
  e: './test/mock/event', // mock event location
  ctx: './test/mock/context', // mock context location
  fn: './test/mock/fn', // mock function location
  handler: 'myHandler', // lambda handler to be called
};

describe('Lambda Test', () => {
  describe('#handler()', () => {
    it('should run successfully', (done) => {
      runLambda(config).then(done()).catch((err) => {
        done(err);
      });
    });
    it('should return a valid response object', (done) => {
      runLambda(config).then((response) => {
        expect(response).to.be.an('object');
        expect(response.alt).to.be.a('string');
      }).then(done).catch((err) => {
        done(err);
      });
    });
  });
});

Config

All config resource paths should be based from your project root. See ./test/mock for examples.

{
  e: './test/mock/event', // mock event location
  ctx: './test/mock/context', // mock context location
  fn: './test/mock/fn', // mock function location
  handler: 'myHandler', // lambda handler to be called
};

Install

With NPM

npm i -D aws-lambda-test-helper

Without NPM

Inside your project clone this repo: git clone https://github.com/dannycroft/aws-lambda-test-helper.git then require it from inside your tests const runLambda = require('../aws-lambda-test-helper');

Test

npm run test

Keywords

FAQs

Package last updated on 25 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc